Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-13007

SOAP authentication fails on WP with CCRM 4.3+

    Details

      Description

      During SOAP authentication against Wordpress 3.5.1+ and CCRM 4.3+ you get the following error:

      Call to undefined function wp_authenticate()

      This error is thrown in CRM_Utils_System_WordPress::authenticate (line 367 in CCRM 4.3.4, line 364 in CCRM 4.3.0)

      $user = wp_authenticate($name, $password);

      Here's a proposed fix (line #s are for CCRM 4.3.0):

      1. edit <your_wp_location>/wp-content/plugins/civicrm/civicrm/CRM/Utils/SoapServer.php to load bootstrap when in WordPress environment:

      128c128
      < if ($this->ufClass == 'CRM_Utils_System_Joomla' || $this->ufClass == 'CRM_Utils_System_WordPress'){

      > if ($this->ufClass == 'CRM_Utils_System_Joomla'){

      2. edit <your_wp_location>/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php
      to load the bootstrap using an instance of CRM_Utils_System_WordPress class rather than calling it as a static method ( calling it as a static method results in errors when called from SOAP layer due to some changes that happened in CRM_Utils_System_WordPress::loadBootStrap and CRM_Utils_System_WordPress::cmsRootPath functions, in particular the fact that they now contain calls using a $this instance rather than static calls to self:: as before and when called from the SOAP layer $this means SoapServer instance which results in errors):

      361c361
      < self::loadBootstrap($name, $password);

      > $config->userSystem->loadBootstrap($name, $password);

        Attachments

          Activity

            People

            • Assignee:
              pratik.joshi Pratik Joshi
              Reporter:
              alleyla Leyla Alieva
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: