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-12-2002 12:22 PM

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

GK_ng 03-12-2002 01:07 PM

Quote:

Originally posted by mvigod
Good update. I'll update my original if ok w/you.
Thanks ;)

And surely not a problem from my side.

Jawelin 04-19-2002 01:58 PM

Quote:

Originally posted by mvigod
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.
[...]

Hi. Great hack even the variation.
Do you plan to update the original instructions, so long ?
Thanks

Jawelin 04-19-2002 02:13 PM

Quote:

Originally posted by GK_ng
as this Hack added a bunch of Queries, I did a redesign of this genious hack:

replace it with
Code:

SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
        thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
        lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach,subscribethread.subscribethreadid AS subscribed
        FROM thread
        LEFT JOIN subscribethread
          ON (subscribethread.threadid=thread.threadid AND subscribethread.userid='".$bbuserinfo['userid']."')
        ".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
        $dotjoin
        WHERE $threadids
        ORDER BY sticky DESC, $sortfield $sqlsortorder
        ");

Full Credits to mvigod for the idea and the first release of this hack ...

Excuse me, GK_ng...
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

mvigod 04-19-2002 03:57 PM

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...

Jawelin 04-19-2002 04:13 PM

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

mvigod 04-19-2002 04:48 PM

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:

//Subscribed hack begin
unset($show_subscribed); // empty variable out
if ($thread[subscribed])
{
$show_subscribed=" <a href=\"member2.php?s=$session[sessionhash]&action=viewsubscription&daysprune=1000\"><img
 src=\"http://www.yourdomain.com/images/subscribed-icon.gif\" align=\"middle\" width=15 height=15 border=0 a
lt=\"You are subscribed to this thread. Click to view all subscriptions\"></A> "
;
}
//Subscribed Hack End 


BEFORE THIS:

PHP Code:

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


Next again in forumdisplay.php


Find:

PHP Code:

$threads=$DB_site->query("
SELECT 
$dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
    thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
    lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach
    FROM thread
    "
.iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
    
$dotjoin
    WHERE 
$threadids
    ORDER BY sticky DESC, 
$sortfield $sqlsortorder
    "
); 



Change to:

PHP Code:

$threads=$DB_site->query("
SELECT 
$dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
    thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
    lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach,subscribethread.subscribethreadid AS subscribed
    FROM thread
          LEFT JOIN subscribethread  ON (subscribethread.threadid=thread.threadid AND subscribethread.userid='"
.$bbuserinfo['userid']."')
    "
.iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
    
$dotjoin
    WHERE 
$threadids
    ORDER BY sticky DESC, 
$sortfield $sqlsortorder
    "
); 


Now 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

and change 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


That's all...the users can click the "S" icon (download icon from first post) and view all their subscribed threads as well.

mashby 05-05-2002 11:37 PM

Installed the original version and it works like a champ. Thank you!

Any chance of getting this to work on Subscribed Forums as well?

mvigod 05-06-2002 02:45 PM

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 01:45 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.01111 seconds
  • Memory Usage 1,771KB
  • 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
  • (1)bbcode_code_printable
  • (6)bbcode_php_printable
  • (3)bbcode_quote_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
  • (9)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