CRM-14880
authorjitendrapurohit <jituraj7760@gmail.com>
Tue, 24 Jun 2014 12:58:56 +0000 (18:28 +0530)
committerjitendrapurohit <jituraj7760@gmail.com>
Tue, 24 Jun 2014 12:58:56 +0000 (18:28 +0530)
CRM/Utils/System/WordPress.php

index 78ad9f0d9239d79e087277c876b185043f752c19..9e0048f21f3d4be36efea361be4369b7236e4710 100644 (file)
@@ -475,6 +475,16 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
       date_default_timezone_set($wpUserTimezone);
       CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
     }
+    require_once ($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-includes/pluggable.php');
+    $uid = CRM_Utils_Array::value('uid', $name);
+    if ($uid) {
+      $account = wp_set_current_user($uid);
+      if ($account && $account->data->ID) {
+        global $user;
+        $user = $account;
+        return TRUE;
+      }
+    }
     return true;
   }