I'm attempting to implement a workaround to this known bug.
Essentially, xf utilizes $visitor.alerts_unread instead of $alertsUnread in 'navigation_visitor_tab' when displaying the number of unread alerts.
The value stored in $visitor.alerts_unread can become incorrect over time, as unread alerts get purged after 30 days (hard-coded in Alerts.php); $visitor.alerts_unread stores the value of unread alerts without accounting for the alerts that are no longer accessible (ones that fall outside of the 30-day limit). The value stored in $alertsUnread contains the correct value that should be displayed. That var, however, is only accessible in 'account_alerts_popup'.
$alertsUnread is set in public function actionAlertsPopup() in Account.php and returned via:
...how can i utilize $alertsUnread in a template outside of 'account_alerts_popup'? either via an edit to the Account.php file, or via a handoff inside of the templates (var container didn't seem to work and i'm unaware of an alternate). i'm not awesome at php edits quite yet, so might need a little coaching if done there.
Essentially, xf utilizes $visitor.alerts_unread instead of $alertsUnread in 'navigation_visitor_tab' when displaying the number of unread alerts.
The value stored in $visitor.alerts_unread can become incorrect over time, as unread alerts get purged after 30 days (hard-coded in Alerts.php); $visitor.alerts_unread stores the value of unread alerts without accounting for the alerts that are no longer accessible (ones that fall outside of the 30-day limit). The value stored in $alertsUnread contains the correct value that should be displayed. That var, however, is only accessible in 'account_alerts_popup'.
$alertsUnread is set in public function actionAlertsPopup() in Account.php and returned via:
Code:
return $this->responseView(
'XenForo_ViewPublic_Account_AlertsPopup',
'account_alerts_popup',
$viewParams
);
...how can i utilize $alertsUnread in a template outside of 'account_alerts_popup'? either via an edit to the Account.php file, or via a handoff inside of the templates (var container didn't seem to work and i'm unaware of an alternate). i'm not awesome at php edits quite yet, so might need a little coaching if done there.
Last edited: