From: Kevin Cristiano Date: Sat, 2 May 2015 12:59:48 +0000 (-0400) Subject: CRM-15629 Fix for IPN issue on 4.6 branch. Call wp-load via CRM_Utils_System::loadB... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=35da5d8d229b07f380171890c6063edf2f79ca89;p=civicrm-core.git CRM-15629 Fix for IPN issue on 4.6 branch. Call wp-load via CRM_Utils_System::loadBootStrap() Original PR https://github.com/civicrm/civicrm-core/pull/5749 ---------------------------------------- * CRM-15629: Paypal IPN not working on Wordpress the first time https://issues.civicrm.org/jira/browse/CRM-15629 Conflicts: CRM/Core/Permission/WordPress.php --- diff --git a/CRM/Core/Permission/WordPress.php b/CRM/Core/Permission/WordPress.php index 3f881137a3..0e392ae8f7 100644 --- a/CRM/Core/Permission/WordPress.php +++ b/CRM/Core/Permission/WordPress.php @@ -58,6 +58,7 @@ class CRM_Core_Permission_WordPress extends CRM_Core_Permission_Base { return TRUE; } + // CRM-15629 // During some extern/* calls we don't bootstrap CMS hence // below constants are not set. In such cases, we don't need to // check permission, hence directly return TRUE @@ -65,6 +66,11 @@ class CRM_Core_Permission_WordPress extends CRM_Core_Permission_Base { return TRUE; } + if (!defined( ABSPATH ) || !defined( WPINC ) ) { + require_once 'CRM/Utils/System.php'; + CRM_Utils_System::loadBootStrap(); + } + require_once ABSPATH . WPINC . '/pluggable.php'; // for administrators give them all permissions diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 75df85b09f..ba161e69d2 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -342,8 +342,14 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { if (!$cmsRootPath) { CRM_Core_Error::fatal("Could not find the install directory for WordPress"); } - - require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php'; + $path = CRM_Core_BAO_Setting::getItem( 'CiviCRM Preferences', 'wpLoadPhp' ); + if ( ! empty( $path ) ) { + require_once $path; + } elseif ( file_exists( $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php' ) ) { + require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php'; + } else { + CRM_Core_Error::fatal( "Could not find the bootstrap file for WordPress" ); + } $wpUserTimezone = get_option('timezone_string'); if ($wpUserTimezone) { date_default_timezone_set($wpUserTimezone);