Firefox PHP

Module: Favorite Forums

Posted by Joe Curia 
Module: Favorite Forums
July 20, 2008 06:07PM
This module allows a logged in user to select favorite forums to be shown together in a My Favorite Forums folder at the top of the index page. The module supports selection of the favorite forums both from the Control Center under Forum Settings and also from the index and list pages. However, the links for the index and list pages will need to be added to their respective templates. Instructions for doing so can be found below. All links and headers can be customized for any language by following the language customization instructions below.

Installation and Usage:
After copying the module files and enabling the module, users will be able to select favorite forums by going to their Control Center -> Forum Settings page. If you would like to enable Add To Favorites and Remove From Favorites you will need to add some code to your templates index_new.tpl, index_classic.tpl, and list.tpl. The simplest way to do this is to copy the Mark Read sections of code and duplicate them, changing MARK_READ to ADD_FAVORITE and REMOVE_FAVORITE, and LANG->MarkForumRead to LANG->phorum_mod_favorite_forums->AddToFavorites and LANG->phorum_mod_favorite_forums->RemoveFromFavorites respectively. For the Emerald template and others based off of it, you will also want to remove the class="icon icon-tag-green" from the anchor to avoid duplicating the Mark Read icon.

So, if you are using the Emerald template, your index_new.tpl will look something like this:
{IF FORUMS->URL->MARK_READ}<a class="icon icon-tag-green" href="{FORUMS->URL->MARK_READ}">{LANG->MarkForumRead}</a>&nbsp;&nbsp;&nbsp;{/IF}
<!-- Added for Favorite Forums mod -->
{IF FORUMS->URL->ADD_FAVORITE}<a href="{FORUMS->URL->ADD_FAVORITE}">{LANG->phorum_mod_favorite_forums->AddToFavorites}</a>{/IF}
{IF FORUMS->URL->REMOVE_FAVORITE}<a href="{FORUMS->URL->REMOVE_FAVORITE}">{LANG->phorum_mod_favorite_forums->RemoveFromFavorites}</a>{/IF}

And your list.tpl will look something like this:
{IF URL->MARK_READ}
    <a class="icon icon-tag-green" href="{URL->MARK_READ}">{LANG->MarkForumRead}</a>
{/IF}
<!-- Added for Favorite Forums mod -->
{IF URL->ADD_FAVORITE}<a href="{URL->ADD_FAVORITE}">{LANG->phorum_mod_favorite_forums->AddToFavorites}</a>{/IF}
{IF URL->REMOVE_FAVORITE}<a href="{URL->REMOVE_FAVORITE}">{LANG->phorum_mod_favorite_forums->RemoveFromFavorites}</a>{/IF}

To customize the links and headers for your language, copy the english.php in this mod's lang folder and rename it so that it has the same name as your main language file (found in the ./include/lang folder). Then edit the new language file with the appropriate translations. If you do create a custom language file, please considering uploading it to this module's thread on the Phorum website for others to use.

Changelog:
v5.2.1.04
    - Bugfix: Users can now deselect all favorited forums from the Control 
      Center. Thanks go to Phorum user masei1202 for reporting this bug.
    - Bugfix: Removed various PHP notices.
    - Bugfix: Updated Phorum version requirement to be compatible with the 
      Phorum version checker.
v5.2.1.03
    - Bugfix: Url's are now crafted using the proper Phorum functions for better 
      compatibility with other modules.  Thanks go to Phorum user 
      equus-webdesign for reporting this bug.
v5.2.1.02
    - Enhancement: Support added for the Simple Rounded template.
    - Bugfix: Forum selection now includes multiple layers of folders and 
      forums, showing only those to which the user is allowed read access.
    - Bugfix: The Control Center settings will now only show on the Forum 
      Settings panel.
    - Bugfix: Forums not shown on Forum Settings page due to array_merge 
      overwriting forum ids with sequential index numbers
v5.2.1.01
	- Fixed a bug which would not allow the user to select forums if there 
	  were no folders.
	- Confirmed compatibility with Phorum 5.2.8.
v5.2.1.00
	- Initial version
Todo:
- Add support for the Tabbed Emerald template

- Add features as they are requested and fix bugs as they are reported.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 5 time(s). Last edit at 11/01/2010 07:05PM by Joe Curia.


Attachments:
open | download - favorite_forums_v5_2_1_04.zip (7.5 KB)
Module: Favorite Forums v5.2.1.01 - bug fix
July 29, 2008 09:49PM
I have finished v5.2.1.01 of the mod with these changes:

- Fixed a bug which would not allow the user to select forums if there were no folders.

- Confirmed compatibility with Phorum 5.2.8.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Favorite Forums
August 06, 2008 11:58PM
Somehow when there is more than 1 page the Add to Favorites messes up the format:


Re: Module: Favorite Forums
August 07, 2008 01:34AM
Hmm, it must be a div/page size issue. Try adding the new link somewhere else in the template. However, this mod is not yet compatible with my Tabbed Emerald template. That template will not show a favorites folder. It is on my to do list, but August is a very busy month for me, sorry.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Favorite Forums
August 07, 2008 02:14AM
Yeah, I was wondering about that too. I downloaded many many modules over the past few days and then I found Tabbed Emerald and this, jumpmenu, and several other ones all do not seem to be working.
Re: Module: Favorite Forums
October 27, 2008 08:47AM
Two notices:

1) this module conflicts with module onlineusers: the onelineusers information is stripped out for the list of forums who are not favorites.

2) it does not take on account the users groups. For instance I have installed a forum only seen by the moderators of our forum, but it appears in the list of availlable forums.
Re: Module: Favorite Forums
October 27, 2008 05:28PM
Please redownload the module. I did see an issue with displaying forums in the Forum Settings page, but it does not seem to be related to either of your issues.

What version of Phorum are you running?

I have tested this mod on 5.2.9 with the online users and a forum with group access only. The online user info showed on all pages as expected. The list of forums for selection from the Forum Settings page showed only the forums my test users had access to.

Could you create a test user and make sure that user cannot access the moderator-only forum?

Could you be more specific as to which online user information is not showing on the list pages of forums not set as favorites? Is the entire online user area not shown? Is a particular user not shown?

Finally, what are your settings for the online user module?


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Favorite Forums
October 27, 2008 06:45PM
I join a print screen with two windows, the one on the left run your last release of favorite_phorum, the other, on the right runs my hacked version.

You may see two errors with your version:
1) onlineusers not working
2) an error with add/remove forums, not taken on account properly

Your last version still don't work with my moderators only forums (may be I did not set it properly as the documentation about users groups is very scarce on Phorum!) I made an user group "LPV admin" and a forum "LPV admin with" no right for any users.

It displays that forums in the forum options combo box.

Joined also my settings for onlineusers.


Re: Module: Favorite Forums
October 27, 2008 07:27PM
1. What code did you add to your index page to show the online user info inline with the forum titles/links? I need to see that to debug.

2. With your moderator-only forum, did you create a non-admin/non-moderator user to confirm that the forum does not show up as a possible favorite? Please note that your admin account will always have access to that forum, even if you do not make your account an explicit member of the moderator group. I have registered a testuser account for your forum, could you please activate that account so I can see the problem first-hand?

Thanks


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Favorite Forums
October 27, 2008 07:52PM
I did not change anything, the
Language: PHP
$forums[$tempid]['description'] .= "<span class=\"onlineusers_readers\">$str</span>";

of onlineusers.php make it to appear in the
{IF FORUMS->description}{FORUMS->description}{/IF}
of index_new.tpl

the hack I have done in your code, I have changed your:

Language: PHP
if (!in_array("favorites",$PHORUM["args"])) { foreach ($forum_source as $forum_id => $forum_data) { $forum_data["URL"]["ADD_FAVORITE"] = str_replace("/list.php?","/index.php?",$forum_data["URL"]["LIST"].",addfavorite,index"); $forums[$i] = $forum_data; $i++; }
into

Language: PHP
$j = 0; if (!in_array("favorites",$PHORUM["args"])) { foreach ($forum_source as $forum_id => $forum_data) { $forum_data = $data[$j]; $forum_data["URL"]["LIST"] = phorum_get_url( PHORUM_LIST_URL, $forum_data["forum_id"] ).",favorites"; $forums[$i] = $forum_data; $i++; $j++; }

Joined two print screen of an non admin user you may notice "LPV admin" appears in the options but not on the screen


Sorry, only registered users may post in this forum.

Click here to login