Skip to content

Commit

Permalink
Optimization: Store user ID into variable
Browse files Browse the repository at this point in the history
To avoid calling the same function twice
  • Loading branch information
pH-7 committed Jul 26, 2020
1 parent e56b25d commit 8a746d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions _protected/framework/Mvc/Controller/Controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,15 @@ private function setModsStatusTplVars()

private function setUserNotifications()
{
$iMemberId = $this->session->get('member_id');

$aNotificationCounter = [
'count_unread_mail' => MailCoreModel::countUnreadMsg($this->session->get('member_id')),
'count_pen_friend_request' => FriendCoreModel::getPending($this->session->get('member_id'))
'count_unread_mail' => MailCoreModel::countUnreadMsg($iMemberId),
'count_pen_friend_request' => FriendCoreModel::getPending($iMemberId)
];
$this->view->assigns($aNotificationCounter);

unset($aNotificationCounter);
unset($aNotificationCounter, $iMemberId);
}

/**
Expand Down

0 comments on commit 8a746d6

Please sign in to comment.