From ce4cd7e02bc0f1a87f696b12712a45e0eab4a42e Mon Sep 17 00:00:00 2001 From: Christian Wach <needle@haystack.co.uk> Date: Wed, 5 Jun 2013 10:13:53 +0100 Subject: [PATCH] added some actions and filters for plugins to hook to --- civicrm.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/civicrm.php b/civicrm.php index 7a8ce44..77d90f7 100644 --- a/civicrm.php +++ b/civicrm.php @@ -998,7 +998,7 @@ class CiviCRM_For_WordPress { * Callback function for 'profile_update' hook * * CMW: seems to (wrongly) create new CiviCRM Contact every time a user changes their - * first_name or last_name attributes + * first_name or last_name attributes in WordPress. */ public function update_user( $userID ) { @@ -1021,7 +1021,7 @@ class CiviCRM_For_WordPress { ); /* - // synchronizeUFMatch returns the contact object + // IN progress: synchronizeUFMatch does return the contact object, however $civi_contact = CRM_Core_BAO_UFMatch::synchronizeUFMatch( $user, // user object $user->ID, // ID @@ -1030,6 +1030,9 @@ class CiviCRM_For_WordPress { 'WordPress' // CMS 'Individual' // contact type ); + + // now we can allow other plugins to do their thing + do_action( 'civicrm_contact_synced', $user, $civi_contact ); */ } @@ -1053,7 +1056,7 @@ class CiviCRM_For_WordPress { } // Minimum capabilities (Civicrm permissions) arrays - $min_capabilities = array( + $default_min_capabilities = array( 'access_civimail_subscribe_unsubscribe_pages' => 1, 'access_all_custom_data' => 1, 'access_uploaded_files' => 1, @@ -1067,6 +1070,9 @@ class CiviCRM_For_WordPress { 'view_public_civimail_content' => 1, ); + // allow other plugins to filter + $min_capabilities = apply_filters( 'civicrm_min_capabilities', $default_min_capabilities ); + // Assign the Minimum capabilities (Civicrm permissions) to all WP roles foreach ( $wp_roles->role_names as $role => $name ) { $roleObj = $wp_roles->get_role( $role ); @@ -1104,7 +1110,7 @@ class CiviCRM_For_WordPress { } // give access to civicrm page menu link to particular roles - $roles = array( 'super admin', 'administrator' ); + $roles = apply_filters( 'civicrm_access_roles', array( 'super admin', 'administrator' ) ); foreach ( $roles as $role ) { $roleObj = $wp_roles->get_role( $role ); if ( -- GitLab