Skip to content

Commit

Permalink
Merge pull request #247 from christianwach/lab-wp-96-2
Browse files Browse the repository at this point in the history
Prevent pages and metabox from loading until CiviCRM is installed
  • Loading branch information
kcristiano authored Mar 27, 2021
2 parents f45758b + 209db11 commit 61c2e34
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions includes/admin-metaboxes/civicrm.metabox.contact.add.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class CiviCRM_For_WordPress_Admin_Metabox_Contact_Add {
*/
public function __construct() {

// Bail if CiviCRM is not installed.
if (!CIVICRM_INSTALLED) {
return;
}

// Store reference to CiviCRM plugin object.
$this->civi = civi_wp();

Expand Down
9 changes: 7 additions & 2 deletions includes/admin-pages/civicrm.page.integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function __construct() {
// Disable until Messages API is active.
return;

// Bail if CiviCRM is not installed.
if (!CIVICRM_INSTALLED) {
return;
}

// Store reference to CiviCRM plugin object.
$this->civi = civi_wp();

Expand Down Expand Up @@ -91,14 +96,14 @@ public function register_hooks() {
/**
* Get the capability required to access the Settings Page.
*
* @since 5.35
* @since 5.37
*/
public function access_capability() {

/**
* Return default capability but allow overrides.
*
* @since 5.35
* @since 5.37
*
* @param str The default access capability.
* @return str The modified access capability.
Expand Down
9 changes: 7 additions & 2 deletions includes/admin-pages/civicrm.page.options.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class CiviCRM_For_WordPress_Admin_Page_Options {
*/
public function __construct() {

// Bail if CiviCRM is not installed.
if (!CIVICRM_INSTALLED) {
return;
}

// Store reference to CiviCRM plugin object.
$this->civi = civi_wp();

Expand Down Expand Up @@ -93,14 +98,14 @@ public function register_hooks() {
/**
* Get the capability required to access the Settings Page.
*
* @since 5.35
* @since 5.37
*/
public function access_capability() {

/**
* Return default capability but allow overrides.
*
* @since 5.35
* @since 5.37
*
* @param str The default access capability.
* @return str The modified access capability.
Expand Down

0 comments on commit 61c2e34

Please sign in to comment.