From 2d97420b1ce7498db55e044821ad482dbe584fb3 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 28 Nov 2018 17:28:34 +1300 Subject: [PATCH] [NFC] Extract getUserCheckSum function --- CRM/Contact/Page/View/UserDashBoard.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/Page/View/UserDashBoard.php b/CRM/Contact/Page/View/UserDashBoard.php index 2cc99577e1..a3fb8807de 100644 --- a/CRM/Contact/Page/View/UserDashBoard.php +++ b/CRM/Contact/Page/View/UserDashBoard.php @@ -69,9 +69,9 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); - $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this); + $userChecksum = $this->getUserChecksum(); $validUser = FALSE; - if (empty($userID) && $this->_contactId && $userChecksum) { + if ($userChecksum) { $this->assign('userChecksum', $userChecksum); $validUser = CRM_Contact_BAO_Contact_Utils::validChecksum($this->_contactId, $userChecksum); $this->_isChecksumUser = $validUser; @@ -256,4 +256,17 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { return self::$_links; } + /** + * Get the user checksum from the url to use in links. + * + * @return string + */ + protected function getUserChecksum() { + $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this); + if (empty($userID) && $this->_contactId) { + return $userChecksum; + } + return FALSE; + } + } -- 2.25.1