vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Add "S" icon next to Subscribed Threads w/link to view all subscriptions (https://vborg.vbsupport.ru/showthread.php?t=35619)

mvigod 03-01-2002 10:00 PM

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:

    eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";"); 

And above it put:

PHP Code:

//Subscribed thread with S icon hack begin
$show_subscribed=''// empty variable out for each pass in while loop
$s_iconhack_userid=$bbuserinfo['userid'];
$check_user_subscribed=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE threadid=$thread[threadid] AND userid='$s_iconhack_userid' LIMIT 1");
$subscribed_id=$check_user_subscribed[subscribethreadid];
if (
$subscribed_id>0)

$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> ";

//Subscribed Icon Hack End 


Now go into the admin cp and change the template forumdisplaybit as follows:

Find:

PHP Code:

    <td bgcolor="#13486D" align="left" width="70%"><normalfont>$thread[gotonew$paperclip$thread[movedprefix]$thread[typeprefix]<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a></normalfont> <smallfont>$thread[pagenav]</smallfont></td

Change this to:

PHP Code:

    <td bgcolor="#13486D" align="left" width="70%"><normalfont>$thread[gotonew$paperclip$thread[movedprefix]$thread[typeprefix]<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a></normalfont>$show_subscribed <smallfont>$thread[pagenav]</smallfont></td

Then upload the icon below to your image directory and that's it!

I'll try to upload a demo page in a minute or so.

mvigod 03-02-2002 07:50 PM

Here is a Screenshot:

Floris 03-02-2002 08:24 PM

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 :)

AndyTSJ 03-02-2002 10:09 PM

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.

mvigod 03-02-2002 10:43 PM

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.

AndyTSJ 03-02-2002 10:50 PM

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.

mvigod 03-02-2002 11:09 PM

Did you put the code above the line?

PHP Code:

eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";"); 

If it's after it then it won't work.

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.

AndyTSJ 03-02-2002 11:15 PM

PHP Code:

  $bgclass "alt1";
    }
//Subscribed thread with S icon hack begin 
$show_subscribed=''// empty variable out for each pass in while loop 
$s_iconhack_userid=$bbuserinfo['userid']; 
$check_user_subscribed=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE threadid=$thread[threadid] AND userid='$s_iconhack_userid' LIMIT 1"); 
$subscribed_id=$check_user_subscribed[subscribethreadid]; 
if (
subscribed_id>0

$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> "

//Subscribed Icon Hack End
eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";");

  }
  
$DB_site->free_result($threads);

  
$pagenav getpagenav($totalthreads,"forumdisplay.php?s=$session 

yup, inserted code above the line. Also posted the $show_subscribed in the forumdisplaybit template.

Maybe there is a conflict with another hack already installed.

mvigod 03-03-2002 12:56 AM

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.

Gamingforce 03-03-2002 04:20 AM

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.


All times are GMT. The time now is 12:35 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01204 seconds
  • Memory Usage 1,762KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete