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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2009, 08:03 PM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need help with "threads starter" template conditional

In the threadbit, I have this piece of code:

HTML Code:
<span style="cursor:pointer" onclick="window.open('member.php?$session[sessionurl]u=$thread[postuserid]', '_self')">$thread[postusername]</span>
I want to wrap a condtional around it to test if the thread starter is an administrator and add a title to the display.

Can this be done with template conditionals, if so, which one? All the ones I have tried test for the user rather than the thread starter.

I am thinking something like :

<if condition="$threadstarter = usergroupid 5,6">

for example. Does a template conditional exist for this kind of test?

TIA for any suggestions.
Reply With Quote
  #2  
Old 02-18-2009, 12:27 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try:
HTML Code:
<if condition="is_member_of($thread[postuserid],  6)">stuff</if>
Reply With Quote
  #3  
Old 02-18-2009, 02:34 AM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne, I tried it and got unexpected results. I thought it worked at first. I expected that only the administrators would be selected but it also select post from one of the registered users who is not an administrator.

If I do an explicit "<if condition="$thread['postuserid'] == 1">" only the administrator posts are correctly selected but what I want is to be able to select the usergroupid to which $thread[postuserid] belongs.

When I changed you example to 2 thinking it would select all the "registered users", it didn't select any even through some do exist.

Any ideas?
Reply With Quote
  #4  
Old 02-18-2009, 02:55 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now that I relook at that condition, I can see it won't work. It needs the usergroupid, not the id of the user. Instead of $thread[postuserid], you can try $thread[groupuserid] or just $thread, but I don't think the usergroupid is ever grabbed. And, if it isn't, then you will have to get it with the help of a plugin you write.
Reply With Quote
  #5  
Old 02-18-2009, 05:00 AM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's what I thought just needed to verify it. thanks very much.
Reply With Quote
  #6  
Old 02-18-2009, 05:52 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When you grab the user info, you will want to fetch all the info for the threads all in one query.
Reply With Quote
  #7  
Old 02-18-2009, 10:00 AM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, I haven't started on the query yet, are you thinking I need a join? I was thinking that I would try to do a select on user where userid = $thread[postuserid] and grab the usergroupid from there, like
Code:
$getUserGroup= $vbulletin->db->query_read("SELECT usergroupid FROM `user` WHERE `userid`= $thread[postuserid]);
then I will test for what usergroup and assign it to a $is_admin variable for example.

I only have 4 usergroups that I care about so it not that big of a problem. I would wrap the conditional around my display code:

HTML Code:
<if condition="$is_admin">
I got sidetracked with it because I was trying to use user conditions on a variable value test so it either selected all threads or none. So I am thinking that the thread starter is a variable I should be able to test for to find out what group they are in then add a title or image next to the name in the thread display.

I am thinking that the threadbit_display hook, should that be correct?

If you are thinking something different, I'd be glad to hear about it.

thanks, Michael
Reply With Quote
  #8  
Old 02-18-2009, 03:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look for the query in forumdisplay that grabs all the threads to display there. Right above the query is hopefully a hook. Use that hook to grab the usergroupid of the thread starter.
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 03:47 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.04118 seconds
  • Memory Usage 2,229KB
  • 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
  • (1)bbcode_code
  • (3)bbcode_html
  • (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_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
  • 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