News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Private message warning

Started by margarett, May 16, 2007, 06:43:09 PM

Previous topic - Next topic

margarett

Hi all.

Is there a way to have on index.template.php (or BoardIndex.template.php) a warning if the user is reaching is limit of PMs?

For instance, a usergroup has 20 PMs limit, and I would like to warn them on 18 or more PMs.

Thanks ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

kerrang!

I've seen this feature although I haven't found it myself either. If anyone knows how to do this I would be very greatful if you could point me in the right direction.

Kerrang =)
I'm my own worst enemy! :P

Css Help <--Having difficulty matching the look of the code function with the style of "quote".. =)

margarett

Hi all.

Well, I made some coding experiences, and I *THINK* I know how to do it, just need to test it better.

My problem is, using firefox I can open the page, and find no major delay, but using IE the page takes forever to load, until it stops with an "excess memory allocated" error. I know this is a server limitation, but why does it only happens on IE?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

Hi again.

I finally managed to get this to work. If someone wishes to make this a MOD, you are welcome.
Anyway, I picked a function from "PersonalMessages.php", modified it a bit, and then all what's needed is a very small amount of code.

So, here it goes:

Find:

/* Show sticky and lock status seperate from topic icons? Leave true, icons don't exist for false.*/
$settings['seperate_sticky_lock'] = true;
}


After, add:
function PMIndex()
{
global $txt, $scripturl, $sourcedir, $context, $user_info, $user_settings, $db_prefix, $ID_MEMBER;


// Load up the members maximum message capacity.
if (!$user_info['is_admin'])
{
// !!! Why do we do this?  It seems like if they have any limit we should use it.
$request = db_query("
SELECT MAX(maxMessages) AS topLimit, MIN(maxMessages) AS bottomLimit
FROM {$db_prefix}membergroups
WHERE ID_GROUP IN (" . implode(', ', $user_info['groups']) . ')', __FILE__, __LINE__);
list ($maxMessage, $minMessage) = mysql_fetch_row($request);
mysql_free_result($request);

$context['message_limit'] = $minMessage == 0 ? 0 : $maxMessage;
}
else
$context['message_limit'] = 0;
}


Find:
<body>';

After, add:

PMIndex();

if ($context['user']['is_logged'] && $context['allow_pm'] && $context['message_limit'] > 0)
{
$aux_calc = $context['message_limit'] - $context['user']['messages'];
if (($aux_calc <= 2) && ($aux_calc != 0))
echo' <div align="center"; style="font-size: 20pt; color: #ffffff">PM BOX ALMOST FULL</div>';
elseif ($aux_calc == 0 )
echo' <div align="center"; style="font-size: 20pt; color: #ffffff">PM BOX FULL!</div>';

}


You can add those text strings to languages, etc etc... In my case, I do not need different languages, so I made it this way.

This was tested in IE6 and FF, but I belive it should work everywhere.

As for the previous error with IE and that excess memory error, in this new hosting it is not a problem.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: