New Count module
Posted by Panu
Re: New message count for future version 5.2 May 11, 2007 04:40AM |
Registered: 17 years ago Posts: 6 |
Found a small bug in the, when you go to index.php and there is no forums to display (e.g. they're all private and your account doesn't have access to them) you get a PHP error:
Notice: Undefined index: MOD_NEW_COUNT in C:\www\phorum\mods\new_count\new_count.php on line 152
This is because the index hook is never reached if no forums are found, thus the data isn't setup properly.
This is easily fixed by sticking:
if(!count($PHORUM["DATA"]["FORUMS"])) return;
somewhere early in mod_new_count_after_header().
Happens during quite rare/silly circumstances, but still. :)
Notice: Undefined index: MOD_NEW_COUNT in C:\www\phorum\mods\new_count\new_count.php on line 152
This is because the index hook is never reached if no forums are found, thus the data isn't setup properly.
This is easily fixed by sticking:
if(!count($PHORUM["DATA"]["FORUMS"])) return;
somewhere early in mod_new_count_after_header().
Happens during quite rare/silly circumstances, but still. :)
May 11, 2007 06:22AM |
Admin Registered: 20 years ago Posts: 8,532 |
There's nothing wrong with nitpicking ;-)
I've got this code in my latest version of the new_count module already:
Ah, I'm at 1.12 in my module repository, but I uploaded only up to 1.10. Probably because I didn't thinkt the bugs were that bad. My changelogs for the last two versions:
I uploaded the latest release in this message.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
I've got this code in my latest version of the new_count module already:
// If we have no forums at all, then the new count will not be set. if (!isset($PHORUM["DATA"]["MOD_NEW_COUNT"])) return;
Ah, I'm at 1.12 in my module repository, but I uploaded only up to 1.10. Probably because I didn't thinkt the bugs were that bad. My changelogs for the last two versions:
1.11 Fixed PHP warning that was shown in case no forums were defined at all. 1.12 Fixed another couple of small undefined index warnings.
I uploaded the latest release in this message.
Maurice Makaay
Phorum Development Team



Re: New Count module January 02, 2008 01:50AM |
Registered: 20 years ago Posts: 278 |
January 02, 2008 05:24AM |
Admin Registered: 20 years ago Posts: 8,532 |
The "emerald" template does not use {MESSAGES->new} as a string in the template. It only uses it to change the icon in front of the thread subjects. It is however possible to add some code to your template to take care of this yourself. I did try to build a feature that automatically adds the info, but that was not possible. It was possible to add "(1 new)" to the subject, but it wasn't clickable that way, because the link would end up embedded inside the full subject line link.
I did some updates to the module to clean up some code and to extend the documentation in the README file to show how to edit "emerald" for displaying new message counts on the list page. I uploaded it as version 1.13 in the Phorum 5.2 modules forum. Here's the excerpt from the updated documentation that applies to your case:
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Edited 1 time(s). Last edit at 01/02/2008 05:25AM by mmakaay.
I did some updates to the module to clean up some code and to extend the documentation in the README file to show how to edit "emerald" for displaying new message counts on the list page. I uploaded it as version 1.13 in the Phorum 5.2 modules forum. Here's the excerpt from the updated documentation that applies to your case:
The default Phorum 5.1 template will already show the amount of new messages for threads on the list page if you have this module enabled. The default Phorum 5.2 template ("emerald") however, will not do so. In that template, the new message information {MESSAGES->new} is just used to change the icon in front of threads that contain new messages. To display the number of new messages for threads in that template, you will have to edit the list.tpl template. You can use these template variables inside the {LOOP MESSAGES} loop: {MESSAGES->new} A formatted string "[X] new" that is set if there are new messages for the thread. {MESSAGES->new_count} The number of new messages for the thread. You can for example use the following code somewhere after the {MESSAGES->subject} in list.tpl to match the old 5.1 behavior: {IF MESSAGES->new} <a href="{MESSAGES->URL->NEWPOST}"> <span class="new-indicator">{MESSAGES->new}</span> </a> {/IF}
Maurice Makaay
Phorum Development Team



Edited 1 time(s). Last edit at 01/02/2008 05:25AM by mmakaay.
Sorry, only registered users may post in this forum.