Skip to content

Commit

Permalink
Merge pull request #25545 from eileenmcnaughton/smarty_tpl2
Browse files Browse the repository at this point in the history
Fix e-notice & php8.2 issue on user dashboard
  • Loading branch information
mattwire authored Apr 19, 2023
2 parents 957bbae + d6dbdc7 commit ae28b88
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions CRM/Contact/Page/View/UserDashBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,12 @@ public function __construct() {
$userID = CRM_Core_Session::getLoggedInContactID();

$userChecksum = $this->getUserChecksum();
$validUser = FALSE;
if ($userChecksum) {
$this->assign('userChecksum', $userChecksum);
$validUser = CRM_Contact_BAO_Contact_Utils::validChecksum($this->_contactId, $userChecksum);
$this->_isChecksumUser = $validUser;
}
$this->assign('userChecksum', $userChecksum);

if (!$this->_contactId) {
$this->_contactId = $userID;
}
elseif ($this->_contactId != $userID && !$validUser) {
elseif ($this->_contactId != $userID && !$userChecksum) {
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::VIEW)) {
CRM_Core_Error::statusBounce(ts('You do not have permission to access this contact.'));
}
Expand Down Expand Up @@ -95,6 +90,8 @@ public function preProcess() {

/**
* Build user dashboard.
*
* @throws \CRM_Core_Exception
*/
public function buildUserDashBoard() {
//build component selectors
Expand Down Expand Up @@ -157,7 +154,7 @@ public function buildUserDashBoard() {
$this->assign('pcpInfo', $pcpInfo);
}

if (!empty($dashboardOptions['Assigned Activities']) && empty($this->_isChecksumUser)) {
if (!empty($dashboardOptions['Assigned Activities']) && !$this->getUserChecksum()) {
// Assigned Activities section
$dashboardElements[] = [
'class' => 'crm-dashboard-assignedActivities',
Expand Down Expand Up @@ -249,11 +246,12 @@ public static function &links() {
/**
* Get the user checksum from the url to use in links.
*
* @return string
* @return string|false
* @throws \CRM_Core_Exception
*/
protected function getUserChecksum() {
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this);
if (empty($userID) && $this->_contactId) {
if ($this->_contactId && CRM_Contact_BAO_Contact_Utils::validChecksum($this->_contactId, $userChecksum)) {
return $userChecksum;
}
return FALSE;
Expand Down

0 comments on commit ae28b88

Please sign in to comment.