Commit 1deb99eb authored by Christian Wach's avatar Christian Wach

Merge branch 'hooks' into 'master'

Run permissions sync when the status of CiviCRM Extensions changes

See merge request plugins/civicrm-permissions-sync!4
parents 1e739772 66c55ef8
...@@ -184,7 +184,9 @@ class CiviCRM_Permissions_Sync { ...@@ -184,7 +184,9 @@ class CiviCRM_Permissions_Sync {
/** /**
* Register hooks. * 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 * 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 * provide a neat way of ensuring capabilities are synced at the point when
* CiviCRM is activated. * CiviCRM is activated.
...@@ -201,6 +203,15 @@ class CiviCRM_Permissions_Sync { ...@@ -201,6 +203,15 @@ class CiviCRM_Permissions_Sync {
// Sync when CiviCRM activation action fires. // Sync when CiviCRM activation action fires.
add_action( 'civicrm_activation', [ $this, 'capabilities_sync' ], 20 ); 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 );
} }
......
=== CiviCRM Permissions Sync === === CiviCRM Permissions Sync ===
Contributors: needle, tadpole Contributors: needle, kcristiano
Tags: civicrm, permissions, sync Tags: civicrm, permissions, sync
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 5.1 Tested up to: 5.1
......
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