To skip straight to the working code (Beta Version: please report any bugs!) for FB 1.0.3 follow this link
http://www.bestofjoomla.com/component/option,com_fireboard/func,view/Itemid,38/catid,68/id,21521
Well if i'd known it was gonna be this easy, i'd have done it months ago!
I am attaching here instructions to hack several files, make database changes etc which will hopefully allow you to have users subscribe to entire forum categories instead of just threads. Before applying these hacks you MUST read the text immediately following...
- OK First thinsg first this is an ALPHA RELEASE - if you don't know what that means you shouldn't attempt this! It has been tested on only ONE SETUP with a dev server forum. I haven't yet put a live FB forum out to test this on... I suggest you don't either until you've tested it to death.
- There are certain bits this doesn't deal with - users have a list of subscriptions in their profile - this is NOT intended to work with that list.
- It may even berak some of these other functions!
- did I say BACKUP - no - WELL BACKUP!
- I am not particularly equipped to help debug this... so be prepared to get your coding fingers dirty!
- I've used the same language file as the thread subscriptions - so there are technically a few flaws in terminaology... but i wanted quick and easy
OK so now we can get down to hacking some code in... (all code below is GPL.. that means you can use it how you like, it also means it comes with no warranty that it a. works b. wont destroy your system)
Stage 1: you need to modify the database structure slightly. I decided to add a field to the table jos_fb_subscriptions rather than play with anything the devs might use later.
- OK - you need to change the properties for the field jos_fb_subscriptions.thread to allow it to have Null Values
- Then add a new field to the same table called categories, it needs to be an integer, default value 0, indexed, null allowed
Stage 2: open the file: ../components/com_fireboard/templates/default/showcat.php
Here you should go to line 203* and
add
| Code: |
I've had to delete this bit of code cause the forum doesn't like HTML in the code boxes!
I'm attaching it as text file ;«»-)
|
Save the file (and re-upload it if you edited it on a local PC)
Stage 3 - Open the file: ../components/com_fireboard/templates/default/post.php
Find line 232 and change it from:
| Code: |
$database->setQuery("SELECT * FROM #__fb_subscriptions AS a" . "\n LEFT JOIN #__users as u" . "\n ON a.userid=u.id " . "\n WHERE a.thread= '$querythread');
|
to:
| Code: |
$database->setQuery("SELECT * FROM #__fb_subscriptions AS a" . "\n LEFT JOIN #__users as u" . "\n ON a.userid=u.id " . "\n WHERE a.thread= '$querythread' OR a.category='$catid'"«»); //Hacked by SBS
|
Now go to line 922 and replace:
| Code: |
$database->setQuery("INSERT INTO #__fb_subscriptions (thread,userid) VALUES ('$fb_thread','$my->id')"«»);
|
with:
| Code: |
//Start Hack By ShinyBlackShoe to allow category subscribe
if ($fb_thread == "0"«»){ //sub cat instead of thread
$database->setQuery("INSERT INTO #__fb_subscriptions (category,userid) VALUES ('$catid','$my->id')"«»);
}
else {
$database->setQuery("INSERT INTO #__fb_subscriptions (thread,userid) VALUES ('$fb_thread','$my->id')"«»);
}
//End Hack by SBS
|
Save the file, reupload if editing locally.
Stage 4 - Open the file: ../components/com_fireboard/templates/default/userprofile.php
Locate line 556 and replace:
| Code: |
$database->setQuery("DELETE from #__fb_subscriptions where userid=$my->id and thread=$thread"«»);
|
with:
| Code: |
//Start Hack by ShinyBlackShoe to give forum subscribe
if ($thread == "0"«»){ //unsub from cat not thread
$database->setQuery("DELETE from #__fb_subscriptions where userid=$my->id and category=$catid"«»);
}
else {
$database->setQuery("DELETE from #__fb_subscriptions where userid=$my->id and thread=$thread"«»);
}
//End hack by SBS
|
Save and re-uplaod if saved locally.
That should be it! Fingers crossed and get testing...
*I have referenced line numbers - its possible bug fixes etc will throw those no's out so here's the code you are actually looking for:
showcat.php - line 203 is immediately after this:
| Code: |
//this user is allowed to post a new topic:
if ($fbIcons['new_topic']) {
echo '';
}
else {
echo '' . _GEN_POST_NEW_TOPIC . '';
}
}
|