Created
May 12, 2017 21:19
-
-
Save pepebe/ebc26d2c4f41b4d61fe37b4c33bbbe69 to your computer and use it in GitHub Desktop.
Dashboard Widget to display the number of internal Manager messages the user has - MODX Revoluition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dashboard widget to show number of Manager messages | |
$id = $modx->user->get('id'); | |
$output = 'No messages.'; | |
$total = $modx->getCount('modUserMessage',array( | |
'recipient' => $id, | |
)); | |
if($total) { | |
$output = 'You have ' . $total . ' messages'; | |
$unread = $modx->getCount('modUserMessage',array( | |
'recipient' => $id, | |
'read' => 0, | |
)); | |
if($unread) { | |
$output .= ', <span style="color: red;">' . $unread . ' unread</span>'; | |
} | |
$output .= '.<br><a href="[[++base_url]]manager/?a=security/message">Messages</a>'; | |
} | |
return $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment