Module: redirect to list page for single forum setup
Posted by Maurice Makaay
July 03, 2007 02:40PM |
Admin Registered: 17 years ago Posts: 8,532 |
This was already posted in other threads too, but I'll post it here too, so people can find it easier. This tiny module can be used on a single forum Phorum install to automatically redirect the user to the forum message list if otherwise the forum index page (which lists the available forums) would have been shown.
This is a simple single file module. Save this script to your Phorum directory as mods/singleforum.php and edit the $forum_id variable if needed. That variable should contain the id of the forum. This is the number that you can see on the list page as ...url../list.php?1234 (where 1234 would be the $forum_id value). After saving the module script, go to the modules page and activate the "Single Forum" module.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Edited 3 time(s). Last edit at 07/03/2007 02:46PM by mmakaay.
This is a simple single file module. Save this script to your Phorum directory as mods/singleforum.php and edit the $forum_id variable if needed. That variable should contain the id of the forum. This is the number that you can see on the list page as ...url../list.php?1234 (where 1234 would be the $forum_id value). After saving the module script, go to the modules page and activate the "Single Forum" module.
<?php /* phorum module info hook: common|phorum_mod_singleforum hook: after_header|phorum_mod_singleforum_delete_index_url title: Single Forum desc: Never show the forum index, but jump to a specified forum instead. */ function phorum_mod_singleforum () { $forum_id = 1; // change this to the id of the forum to jump to. if (phorum_page == 'index') { phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL, $forum_id)); } } function phorum_mod_singleforum_delete_index_url() { unset($GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"]); } ?>
Maurice Makaay
Phorum Development Team



Edited 3 time(s). Last edit at 07/03/2007 02:46PM by mmakaay.
Re: Module: redirect to list page for single forum setup July 05, 2007 05:29AM |
Registered: 14 years ago Posts: 71 |
July 05, 2007 05:33AM |
Admin Registered: 17 years ago Posts: 8,532 |
You just should have changed "$forum_id = 1;" (isn't that documented clear enough in the above message?), but changing the actual redirect call works too.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Edited 1 time(s). Last edit at 07/05/2007 05:34AM by mmakaay.
Maurice Makaay
Phorum Development Team



Edited 1 time(s). Last edit at 07/05/2007 05:34AM by mmakaay.
Re: Module: redirect to list page for single forum setup June 06, 2009 02:20PM |
Registered: 12 years ago Posts: 7 |
I've tried to use this mod in 5.2, and it looks like the second hook (avoid showing the folder icon and link to the index page) does not work. After a few trials I have found that changing the hook point from "after_header" to "start_output" does the trick. Here is the complete code:
Language: PHP<?php /* phorum module info hook: common|phorum_mod_singleforum hook: start_output|phorum_mod_singleforum_delete_index_url title: Single Forum desc: Never show the forum index, but jump to a specified forum instead. */ function phorum_mod_singleforum () { $forum_id = 1; // change this to the id of the forum to jump to. if (phorum_page == ';index';) { phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL, $forum_id)); } } function phorum_mod_singleforum_delete_index_url() { unset($GLOBALS["PHORUM"]["DATA"]["URL"]["INDEX"]); } ?>
Sorry, only registered users may post in this forum.