Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2013, 12:00 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default HOW-TO Check if user is subscribed to thread?

I'm looking for some kind of conditional in SHOWTHREAD to check if a user is subscribed to the thread.

Basically as of now I have a 'subscribe to thread' button that shows only to members. I was hoping there is a way to add one more conditional to check if the user already subscribed to the thread, in which case the button would disappear.
Reply With Quote
  #2  
Old 08-01-2013, 12:39 PM
mokujin's Avatar
mokujin mokujin is offline
 
Join Date: Oct 2005
Location: Czech
Posts: 345
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this: add new plugin showthread_query
PHP Code:
$hook_query_fields .= " ,subscribethread.*";

$hook_query_joins .= " LEFT JOIN " TABLE_PREFIX "subscribethread AS subscribethread ON (subscribethread.threadid=post.threadid AND subscribethread.userid=post.userid)"
Then in postbit (or postbit_legacy) add this to everywhere.

PHP Code:
<vb:if condition="$post['subscribethreadid']">Subscribed</vb:if> 
Reply With Quote
  #3  
Old 03-17-2014, 09:44 PM
Xexiu Xexiu is offline
 
Join Date: May 2008
Location: Barcelona
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And how to make it work on vbulletin 3.8? Thanks
Reply With Quote
  #4  
Old 03-17-2014, 10:59 PM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Create the plugin as stated above, name it Subscribed.
Hook Location, select, showthread_query

In the Plugin PHP Code message area,
Add:
Code:
$hook_query_fields .= " ,subscribethread.*";

$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON (subscribethread.threadid=post.threadid AND subscribethread.userid=post.userid)";

In your postbit or postbit_legacy template find:


Code:
		<if condition="$post['signature']">
		<!-- sig -->
			<div>
				__________________<br />
				$post[signature]
			</div>
		<!-- / sig -->
		</if>
<br><br><br><br><br><br><br><br><br>
Add below:

Code:
                                <div align="left">
                                <if condition="$post['subscribethreadid']">Subscribed</if>
                        </div>
Reply With Quote
  #5  
Old 03-17-2014, 11:15 PM
Barcham Barcham is offline
 
Join Date: Jan 2014
Location: Montreal
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just install this mod...[OzzModz] Users Subscribed To Thread Block. I have this running and it's great.

https://vborg.vbsupport.ru/showthread.php?t=305173
Reply With Quote
Благодарность от:
Max Taxable
  #6  
Old 03-17-2014, 11:33 PM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Barcham View Post
Just install this mod...[OzzModz] Users Subscribed To Thread Block. I have this running and it's great.

https://vborg.vbsupport.ru/showthread.php?t=305173
The question ask on this 8 month old thread was:

Quote:
And how to make it work on vbulletin 3.8? Thanks
I answered his 3.8 question, your link sends the member to a 4.0 addon, it will not work on vb 3.8
Reply With Quote
Благодарность от:
Max Taxable
  #7  
Old 03-17-2014, 11:41 PM
Xexiu Xexiu is offline
 
Join Date: May 2008
Location: Barcelona
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks blind.

To make it work under ForumDisplay also? Or make it work on all site? Should I change hook location to "global start"?

Much thanks.
Reply With Quote
  #8  
Old 03-18-2014, 12:10 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No plugin needed...

There is an image on the Forum Display page that shows if you are subscribed.
Its a bit small, but does its job.
You would just need to change the image to your liking on the Forum Display page
Reply With Quote
  #9  
Old 03-18-2014, 12:16 AM
Barcham Barcham is offline
 
Join Date: Jan 2014
Location: Montreal
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by blind-eddie View Post
The question ask on this 8 month old thread was:



I answered his 3.8 question, your link sends the member to a 4.0 addon, it will not work on vb 3.8
Agreed, I didn't realize the age of the thread and I was directing my reply to the person who started the thread, as this is the VB4 section after all.
Reply With Quote
  #10  
Old 03-18-2014, 12:21 AM
Xexiu Xexiu is offline
 
Join Date: May 2008
Location: Barcelona
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you mean this (?):
Code:
<if condition="$show['subscribed_to_forum']">
<a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$foruminfo[forumid]" rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a>
<else />
<a href="subscription.php?$session[sessionurl]do=addsubscription&amp;f=$foruminfo[forumid]" rel="nofollow">$vbphrase[subscribe_to_this_forum]</a>
</if>
From forumdisplay template. But when I add the same code to the forumhome_forumbit_level1_post, doesnt work.

Any suggestions?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:24 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05742 seconds
  • Memory Usage 2,271KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete