Topic: Hardcover Tutorial: Keep users informed before they reach PM limits
Today I will show you how I keep users informed on messages: total messages and messages sent today.
Main idea is start to show messages limits info only when user reaches certain percent of limits or higher.
1. In Compose Message page system will display 'messages sent today' info.
2. In Inbox and Sent system will display total stored messages info.
3. System will also display total messages stored in Inbox and total messages stored in Sent folder.
We need to make slight modifications of account_messages.php and add new template variables:
1. find function show_compose
find
$TEMPLATE->assign("sent_per_day", $SESSION->conf['can_send_per_day']);and add right below it:
$TEMPLATE->assign("sent_today_percent", ($senttoday / $SESSION->conf['can_send_per_day'] * 100));2. find function show_inbox
find (I found two of them and safely deleted one(you'd better not do this)
$TEMPLATE->assign("total_messages", ($SESSION->conf['totalimessages'] + $SESSION->conf['totalsmessages']));and paste after it:
$TEMPLATE->assign("total_imessages", $SESSION->conf['totalimessages']);
$TEMPLATE->assign("total_messages_percent", ($SESSION->conf['totalimessages'] + $SESSION->conf['totalsmessages']) / $SESSION->conf['maxmessages'] * 100);3. find function show_sent
find (I found two of them - one dublicating - and safely deleted one(you'd better not do this))
$TEMPLATE->assign("total_messages", ($SESSION->conf['totalimessages'] + $SESSION->conf['totalsmessages']));and paste after it:
$TEMPLATE->assign("total_smessages", $SESSION->conf['totalsmessages']);
$TEMPLATE->assign("total_messages_percent", ($SESSION->conf['totalimessages'] + $SESSION->conf['totalsmessages']) / $SESSION->conf['maxmessages'] * 100);Now your system ready to use those variables in .tpl
1. Open account_messages_compose.tpl
and add right after
<!-- INCLUDE message.tpl -->
<!-- IF hide_content != "1" -->this:
<!-- IF sent_today_percent > "70" -->
<div class="<!-- IF sent_today_percent > "90" -->error<!-- ELSE -->info<!-- ENDIF -->_message">
{compose_info}
</div>
<!-- ENDIF -->2. Open account_messages_inbox.tpl
And add after: {lang:"messages","frm_inbox"}
<!-- IF total_imessages -->({total_imessages})<!-- ENDIF -->This will make you inbox look: Inbox(44)
Add bellow
<!-- INCLUDE message.tpl -->
<!-- IF hide_content != "1" -->this
<!-- IF total_messages_percent > "70" -->
<div class="<!-- IF total_messages_percent > "90" -->error<!-- ELSE -->info<!-- ENDIF -->_message">
{messages_info}
</div>
<!-- ENDIF -->3. Open account_messages_sent.tpl
Add after {lang:"messages","frm_sent"} this:
<!-- IF total_smessages -->({total_smessages})<!-- ENDIF -->This will make you sent box look: Sent(55)
And bellow this
<!-- INCLUDE message.tpl -->
<!-- IF hide_content != "1" -->
Add this:
<!-- IF total_messages_percent > "70" -->
<div class="<!-- IF total_messages_percent > "90" -->error<!-- ELSE -->info<!-- ENDIF -->_message">
{messages_info}
</div>
<!-- ENDIF -->Almost done! Now we need modify site.css for proper visualisation of messages.
Open site.css and at the bottom find info messages and error messages rendering instructions (for example softgreen template's .css)
/* ********** [ MESSAGES ] ********** */
div#info_message {...}
div#info_message a {...}
div#error_message {...}
div#error_message a {...}And add 'div.info_message' for applying this styling not only to div id="info_message" but also for div class="info_message" because this is what we used for messages displaying.
Now it looks this way:
/* ********** [ MESSAGES ] ********** */
div#info_message, div.info_message {...}
div#info_message a, div.info_message a {...}
div#error_message, div.error_message {...}
div#error_message a, div.error_message a {...}Now when user reaches 70% limit he gets info (blue) message that he has 36 message of 50 in his message box.
When user reaches 90% system displays error-style (red) message that he has 46 message of 50.
The similar check when member composes new message. And you can edit notification per cent in your IF condition of tpl. For example 50 and 80. or 80 and 95.
Your users will be happy to know they reaching limits and that will help them keep they mailbox clean before they face any messaging troubles caused by mailbox overflow.
The key is understanding of every line that I wrote. If you do - you'll be fine.
Last edited by radioact (2008-04-03 09:38:06)
www.vldCrowd.com/radioact - my profile at vldCrowd