PDA

View Full Version : How to check user has unread private messages in Vbulletin 5


YankForum
08-13-2014, 07:10 AM
Hi

in vbulletin 3 and 4 it was possible to check user's unread private messages in any template (footer, header ...) with this if condition:

<if condition="$bbuserinfo[pmunread]">user has new pms</if>

but in vb5 how is this possible? i need it to work in header or footer template and not only in provate_message temps

i found this but it checks all types of notifications , unread visitor messages, requests and ... including new private messages :


{vb:data unreadCount, content_privatemessage, getUnreadInboxCount}
{vb:data canUsePmSystem, content_privatemessage, canUsePmSystem}
<vb:if condition="!empty($unreadCount)">
</vb:if>

how is this possible only to check for new private messages instead of all notifications?

regards

YankForum
08-13-2014, 08:03 PM
so for your reference here is the solution:

{vb:data canUsePmSystem, content_privatemessage, canUsePmSystem}
{vb:data folders, content_privatemessage, fetchSummary}
{vb:set folderlist, {vb:raw folders.folders}}
<vb:if condition="$canUsePmSystem">
{vb:set folder, {vb:raw folderlist.messages} }
{vb:set routeInfo.folderid, {vb:raw folder.folderid}}
<vb:if condition="!empty($folder['qty'])">
IF YOU HAVE NEW PRIVATE MESSAGES THIS SHOWS UP
</vb:if>

i dont know if it's the best answer or not but it works! found this in vb message_navigation_menu (vb default theme)
seems you have to define variables first and then assign them values and then use them in if conditions
too many lines of codes for a simple check!