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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2012, 05:16 PM
Abhik's Avatar
Abhik Abhik is offline
 
Join Date: Jun 2006
Location: Kolkata, India
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Check Thread Starter Usergroup and Execute Code

Hello,
How do I check the thread starter's usergroup and execute code based on that?

I mean, something like this:

Code:
<vb:if condition="is_member_of($threadstarter, 5,6,7,9)">
........
<vb:else />
.............
</vb:if>
Is there any possible way?
Reply With Quote
  #2  
Old 02-14-2012, 08:17 PM
Punjabi Munda Punjabi Munda is offline
 
Join Date: May 2007
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes where exactly do you want to do this? The is_member_of should go into your php file and set a boolean to true or false and you can use if statement in your template to behave accordingly
Reply With Quote
  #3  
Old 02-15-2012, 07:20 AM
Abhik's Avatar
Abhik Abhik is offline
 
Join Date: Jun 2006
Location: Kolkata, India
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, its in a template, the threadbit template actually.
Reply With Quote
  #4  
Old 02-15-2012, 03:32 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The $threads query (used to get information for the threadbit template) does not grab the threadstarter's information (like the usergroup). So, you would actually need to add another query per threadbit per page in order to grab that information.
Reply With Quote
  #5  
Old 02-16-2012, 04:36 PM
Abhik's Avatar
Abhik Abhik is offline
 
Join Date: Jun 2006
Location: Kolkata, India
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
The $threads query (used to get information for the threadbit template) does not grab the threadstarter's information (like the usergroup). So, you would actually need to add another query per threadbit per page in order to grab that information.
Thanks Lynne,
What that query should be? Sorry, but I am totally lost here.
Reply With Quote
  #6  
Old 02-17-2012, 01:19 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To be honest, I would not suggest doing that. Is there some other way to do what you want? What is your goal?
Reply With Quote
  #7  
Old 02-18-2012, 10:11 AM
Abhik's Avatar
Abhik Abhik is offline
 
Join Date: Jun 2006
Location: Kolkata, India
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
To be honest, I would not suggest doing that. Is there some other way to do what you want? What is your goal?
Hello Lynne, sorry for replying late.
My goal is to highlight the threadbit in a separate color if the thread started by a member belongs to a specific group.
That's it.
Reply With Quote
  #8  
Old 02-18-2012, 10:54 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think the issue is that you normally try not to add queries because they take up time. The user table is already joined in that query to get the info for the last poster, which may be why there's not usergroup coloring for thread starters by default. Anyway, you could just add a query at threadbit_display to look up the info, but then you're adding one query for each thread. The other thing you could do one "big" query similar to the one that's being done (I'm looking in forumdisplay.php), maybe at forumdisplay_query. I don't know which one's better, it probably depends on a lot of factors.

Anyway, if you didn't care at all about adding queries I think you could do this at threadbit_display:

Code:
$starterinfo = fetch_userinfo($thread['postuserid']);
$thread['starter_musername'] = fetch_musername($starterinfo);

Then you could use {vb:raw thread.starter_musername} in the template. That assumes that what you want is to have the username colored by group in the same way that it would be in other places. (I haven't tried the above code).
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 10:01 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
  • Page Generation 0.04314 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete