MyBB Community Forums

Full Version: Private message variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
i am developing a theme in which i want to show a div with only number of new message. And if no message, no div is shown
Can someone help me with the code is should use?
Edit: AdminCP > templates > your theme's templates > Global Templates > global_pm_alert
its my fourth thread asking about something and this one is the first reply. Sad
but i don't think the template you pointed out has the required variable.

This is is -
<div class="pm_alert" id="pm_notice">
	<div class="float_right"><a href="private.php?action=dismiss_notice&amp;my_post_key={$mybb->post_code}" title="{$lang->dismiss_notice}" onclick="return MyBB.dismissPMNotice()"><img src="{$theme['imgdir']}/dismiss_notice.gif" alt="{$lang->dismiss_notice}" title="[x]" /></a></div>
	<div>{$privatemessage_text}</div>
</div>
<br />

I just want the variable that holds number of unread PM(s). Big Grin
$mybb->user['pms_unread']
Thanks Big Grin .... +rep
But gee, i have another problem. Since mybb template system doesn't allow using PHP, how am i supposed to use conditions?
here is the condition i want to use.
if PM<1 , don't show <div>{$mybb->user['pms_unread']}</div>
if PM=1 or PM>1 , show <div>{$mybb->user['pms_unread']} message(s)</div>

I guess that's pretty much impossible? unless i edit core files?
you know i could've. But i'm designing a theme so....i can't have people install a plugin on their board just to get the theme running Toungue
But if there's no way out, i guess i'll just have to go with that plugin....like we do in wordpress
While I'm not a big fan of bumping threads, other googlers might find this thread looking for a solution.

I've found this to work:
<div id="unreadpms" class="unread{$mybb->user['pms_unread']}">{$mybb->user['pms_unread']} unread message(s)</div>

Then in your global.css:
div#unreadpms.unread0{
    display:none;
}
@tyzoid it's a very nice trick you posted. rep+
yes, very cool trick
Pages: 1 2