1

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)

2

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Wow, awesome tip this, I'll keep it until after the upgrade. THANKS - going to collect your hard cover tutorials - they should make a lounge for that ;-)

3

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

I'm glad that you like it.

AtPetat wrote

they should make a lounge for that ;-)

It's not a secret it's just a good practice

4

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Thanks for it. You're doing great work radioact

5

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Installed and tested the new PM limit alert messages

works perfectly right off the board

for the site.css
this part
{...}

Is the style information you already have.
add the new message divs below the standard divs then,
Just cut and paste your style information between the brackets and remove the three dots

Thanks again Radioact
The script is getting better and better everyday

Last edited by seeme101 (2008-04-03 23:40:22)

6

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

You are welcome.

Just cut and paste your style information between the brackets and remove the three dots

I'd better add ', div.info_message' ', div.error_message' right after 'div#info_message', 'div#error_message'  selectors instead of copy/pasting existing code to place of three dots.

Last edited by radioact (2008-04-03 23:31:33)

7

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

yes,
That's exactly what I did.
Added the new messages divs below the standard divs.
Then cut and pasted the standard style info between the brackets

8

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

But you could just add ', div.info_message' ', div.error_message' right after 'div#info_message', 'div#error_message'
and your styling info would work for both div id="info_message" and div class="info_message" without duplicating styling code

9

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Example. Webby2.
It was (with a bit of above code)

/* ********** [ CONTENT ] ********** */

#content_wrap {
    margin: 0px;
    padding: 0px;
    float: left;
    width: 640px; }

      #content { }


/* ********** [ MESSAGES ] ********** */

div#info_message {
    margin: 10px 10px 0px 10px;
    padding: 10px;
    font: 12px arial;
    color: #aa571b;
    background-color: #FFFFC0;
    border-top: 1px #d8b62d solid;
    border-bottom: 1px #d8b62d solid; }

    div#info_message a {
        font: 12px arial;
        color: #aa571b;
        text-decoration: none; }

    div#info_message a {
        text-decoration: underline; }

div#error_message {
    margin: 10px 10px 0px 10px;
    padding: 10px;
    font: 12px arial;
    color: #800000;
    background-color: #FFD7D7;
    border-top: 1px #9D290D solid;
    border-bottom: 1px #9D290D solid; }

    div#error_message a {
        font: 12px arial;
        color: #800000;
        text-decoration: none; }

    div#error_message a {
        text-decoration: underline; }

And now it is:

/* ********** [ CONTENT ] ********** */

#content_wrap {
    margin: 0px;
    padding: 0px;
    float: left;
    width: 640px; }

      #content { }


/* ********** [ MESSAGES ] ********** */

div#info_message, div.info_message {
    margin: 10px 10px 0px 10px;
    padding: 10px;
    font: 12px arial;
    color: #aa571b;
    background-color: #FFFFC0;
    border-top: 1px #d8b62d solid;
    border-bottom: 1px #d8b62d solid; }

    div#info_message a, div.info_message a {
        font: 12px arial;
        color: #aa571b;
        text-decoration: none; }

    div#info_message a:hover, div.info_message a:hover {
        text-decoration: underline; }

div#error_message, div.error_message {
    margin: 10px 10px 0px 10px;
    padding: 10px;
    font: 12px arial;
    color: #800000;
    background-color: #FFD7D7;
    border-top: 1px #9D290D solid;
    border-bottom: 1px #9D290D solid; }

    div#error_message a, div.error_message a {
        font: 12px arial;
        color: #800000;
        text-decoration: none; }

    div#error_message a:hover, div.error_message a:hover {
        text-decoration: underline; }

By the way I added ':hover' to last lines since their absence seemed to be a typo.

Last edited by radioact (2008-04-04 00:01:24)

10

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Radioact..........do you know if this will work for the new update when it comes out.

Thanks

11

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

I don't know smile I'm not the man who's making a new updates smile But I think it will work and the only thing of it won't work - if they make this in new release by themselves.

Last edited by radioact (2008-04-04 12:15:26)

12

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

This works with version 2.5.3

You will not need to add the total messages part because it is already part of the script.

The alert message for the member getting close to the max allowed message, works just fine

I would call this mod
"an oldie, but goodie"

Last edited by seeme101 (2009-06-14 01:35:19)

13

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

This looks like an awesome mod and really helpful!

Has anybody been able to adapt it for version 2.5.5?  Was not able to find the referenced in the tutorial so presume it was overhaulted completely.

Little Moosie

14

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

in the new version

account_message does not exist?
it is account _messages_inbox(messages,sent,view)

15

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

does this work on latest version of vld?
need a little help to fin the right files

16

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

hmmm, I may be wrong, but I think latest version already has this feature built in as default.

17

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

hey guys i need to now if this is upto date?

and i can't seem to find these files?i only see the lib.account _messages...

thx

18

Re: Hardcover Tutorial: Keep users informed before they reach PM limits

Many thanks to radioact for sharing helpful topics like this.

Does someone knows if this has been included by default in 2.6? (I am still using 2.5.6)

If it has not been added, I ask to Vlad to do it, please, because it's a very user friendly feature that could improve vldpersonals.