Commit 66c55ef8 authored by Christian Wach's avatar Christian Wach

Add callbacks when the status of CiviCRM Extensions changes

parent 4306a8b1
......@@ -184,7 +184,9 @@ class CiviCRM_Permissions_Sync {
/**
* Register hooks.
*
* The two hooks referenced here are native to the CiviCRM WordPress plugin.
* The first two hooks referenced here are native to the CiviCRM WordPress
* plugin itself.
*
* If this plugin active when CiviCRM itself is activated, then these hooks
* provide a neat way of ensuring capabilities are synced at the point when
* CiviCRM is activated.
......@@ -201,6 +203,15 @@ class CiviCRM_Permissions_Sync {
// Sync when CiviCRM activation action fires.
add_action( 'civicrm_activation', [ $this, 'capabilities_sync' ], 20 );
// Sync when a CiviCRM Extension's status changes from uninstalled to enabled.
add_action( 'civicrm_install', [ $this, 'capabilities_sync' ], 20 );
// Sync when a CiviCRM Extension's status changes from disabled to enabled.
add_action( 'civicrm_enable', [ $this, 'capabilities_sync' ], 20 );
// Sync when a CiviCRM Extension's status changes from enabled to disabled.
add_action( 'civicrm_disable', [ $this, 'capabilities_sync' ], 20 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment