From 8ee9bea988bbba8aece74c02f291a617cf041a09 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 22 Sep 2017 07:53:42 +1000 Subject: [PATCH] CRM-21212 Include getUfId function for wordpress to help getting E2E unit tests running for wordpress ---------------------------------------- * CRM-21212: Get E2E Tests working on wordpress https://issues.civicrm.org/jira/browse/CRM-21212 --- CRM/Utils/System/WordPress.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index bfab40510f..65c711b3d2 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -354,6 +354,20 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); } + /** + * Determine the native ID of the CMS user. + * + * @param string $username + * @return int|NULL + */ + public function getUfId($username) { + $userdata = get_user_by('login', $username); + if (!$userdata->data->ID) { + return NULL; + } + return $userdata->data->ID; + } + /** * @inheritDoc */ -- 2.25.1