![]() |
Add "S" icon next to Subscribed Threads w/link to view all subscriptions
This is my first "released" hack so I can give something back for all the cool hacks I found here.
This one is fairly simple. What it does is put a small icon next to the title in any thread that the user has subscribed to. The small icon is a clickable link which will take the user to a page where they can view all of their subscriptions. This requires modifying forumdisplay.php and one template file "forumdisplaybit". Also you must upload the image icon file to your images directory. First let's modify the forumdisplay.php file: Find: PHP Code:
PHP Code:
Now go into the admin cp and change the template forumdisplaybit as follows: Find: PHP Code:
PHP Code:
I'll try to upload a demo page in a minute or so. |
Here is a Screenshot:
|
Hey
that idea is really good!! Thank you for working it out to a full hack :) very nice! I am not sure if I am going to implement it to my forum, but sure will give it a try on my beta version :) |
Didn't seem to work for me. Followed the instructions and installed ok, no technical problems or errors showing, just the small icon and link don't show next to the thread.
|
AndyTSJ - Are the threads you are looking at ones you are sure you have yourself subscribed to? It will only show on those threads so if a page has threads but none are subscribed it will not show.
|
Yea, and I deliberately suscribed to a thread to test it and no luck :( The code is all in as you posted it in your instructions so I can't figure out why it won't work.
|
Did you put the code above the line?
PHP Code:
Also is the variable in the "forumdisplaybit" template and the icon in your image directory? I tested this on 2.2.1 but it should work in 2.2.2 and even earlier versions without problems. |
PHP Code:
Maybe there is a conflict with another hack already installed. |
when you pull up the source code for the html on one of the pages which has a thread you susbscribed to does any of the code appear after the thread title on the one you subscribed to?
Your code above looks ok. Try this just to troubleshoot. Change the if statement from if (subscribed_id>0) to: if (0==0) This will guarantee a true condition. All threads should show up with an S then. Do this quickly to test it if it's on a live board and then undo it fast so all your members don't wonder what all those S's are! If they show up then we've narrowed the problem down or if something is in the html source next to your thread. Let me know as it should be working. |
I am having the same problem as well. I subscribed to some threads but the S icon does not display. I did a quick test with the if 0==0 statement and all threads displayed the S icon.
|
Same here... worked with "if 0==0", each post had an "S" .... just wished I knew a bit of php cuz this is probably a real easy thing to fix. Love the idea though, definitely not gonna give up on this one....
|
OK...I found the problem...in the if statement I missed the dollar sign ($) when changing over the variable names to make them easier to read
it should be: PHP Code:
Note the dollar sign before "subscribed_id" now...before it didn't have it on the original post so it never satisfied the condition. I'll fix the original post so it's updated too. LMK if it works now...must have been a long day when I missed that one :) |
|
AndyTSJ - Looks like you have a border around the icon there....in the image tag make sure you have "border=0" so it shows up as a round circle unless you wanted it that way with the border for some reason. The original code above does in fact already have the "border=0" reference within the image tag.
|
Yea, just the way I did my graphic as opposed to being a border around the image.
|
I modified it to show text instead of an icon, but it works like a dream -- thanks! :D
|
I had text originally for this hack too actually but liked the icon look for my site...images convey meaning to the brain faster than reading which is why I changed over to the icon.
If any user wants to substitute text for the icon just replace the <img> tag code with the text they want to see instead. So if you prefer to use text instead of small "S" icon just replace the piece below from the original code with whatever text you want (i.e. subscribed): PHP Code:
|
Hmmm. even with the $ in front, nothing shows up :(.
|
make sure you are looking at a forum which has a thread that you are definitely subscribed to or you won't see the "S". Also be sure you uploaded the small S image to your images folder. Let me know if this works.
|
as this Hack added a bunch of Queries, I did a redesign of this genious hack:
find: Code:
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')." Code:
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')." PHP Code:
PHP Code:
Instead of Code:
$thread[title]="<i>".$thread[title]."</i>"; Code:
$show_subscribed=" <a href=\"member2.php?s=$session[sessionhash]&action=viewsubscription&daysprune=1000\"><img src=\"images/subscribed-icon.gif\" align=\"middle\" width=15 height=15 border=0 alt=\"You are subscribed to this thread. Click to view all subscriptions\"></A> "; Full Credits to mvigod for the idea and the first release of this hack ... |
GK-ng,
Good update. I'll test it out and then update to my original if ok w/you. I had tried the single database query similar to how you had it but missed a parameter I think on my "ON" clause which resulted in single threads showing up multiple times in a row on a page as my database query was not correct. Because of this I went the other route of a seperate query. If your board is not heavily loaded you are just as well off with either version but if your board is more heavily loaded it's wise to save the query as you point out. I fall into the heavy traffic board so I'll be testing out the query and see if I can remember exactly why I couldn't get it just right back then. Thanks for helping out :) |
Quote:
And surely not a problem from my side. |
Quote:
Do you plan to update the original instructions, so long ? Thanks |
Quote:
Just something. Are you sure if inserting such a LEFT JOIN between thread and subscribethread tables, the later LEFT JOIN with the icon table would be run correctly ? I'm just thinking... what about you ? Thanks |
Actually I think I tried the changes Gk-ng made and got an error so I had to change the query...I'll go back and see what I finally ended up with and repost the variation...my original is easiest for a lower volume board and if you really need to optimize by saving a query then the other version I'll post will work...have to go run through the changes I made now...
|
Thanks.
Hwr. I made it worked simply by moving the LEFT JOIN subscribethread ON .... just before the WHERE clause. This way, the entire table BEFORE is left joint with the subscribethread.... Now it works fine... without adding any query to the page (verified by the Nakkid's Hack...) Thanks again |
This is the alternate form of this hack which will save the query which can be used. Either one will work fine but for those concerned about queries you may certainly wish to use this variation.
In forumdisplay.php ADD THIS: PHP Code:
BEFORE THIS: PHP Code:
Next again in forumdisplay.php Find: PHP Code:
Change to: PHP Code:
Now change the template forumdisplaybit as follows: Find: PHP Code:
PHP Code:
That's all...the users can click the "S" icon (download icon from first post) and view all their subscribed threads as well. |
Installed the original version and it works like a champ. Thank you!
Any chance of getting this to work on Subscribed Forums as well? |
Mashby,
I'll check into it for you once I get a little time to code it and test..should not be hard to add though. |
All times are GMT. The time now is 09:29 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|