Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 04-06-2006, 06:46 PM
libertate's Avatar
libertate libertate is offline
 
Join Date: Feb 2005
Location: Kiribati
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default What is the if condition= for group & logged in?

I am trying to add a field to the postbit, and to show up only if the logged in user is within a specific group.

What is the <if condition="?????"></if> to see if user is in the group(s) and also logged in?
Reply With Quote
  #2  
Old 04-06-2006, 06:55 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HTML Code:
<if condition="is_member_of($posts,2)"> do something </if>
Where 2 is the usergroupid.
Reply With Quote
  #3  
Old 04-07-2006, 01:08 PM
libertate's Avatar
libertate libertate is offline
 
Join Date: Feb 2005
Location: Kiribati
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
HTML Code:
<if condition="is_member_of($posts,2)"> do something </if>
Where 2 is the usergroupid.
Awesome. Thank you.

Last Q - vBulletin.vb_userfield.field1 (admin defined profile field) how do I reference it to display?

i.e.

HTML Code:
<if condition="is_member_of($posts,2)"> display vb_userfield.field1 </if>
Reply With Quote
  #4  
Old 04-07-2006, 01:30 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the postbit
Code:
$post[fieldx]
where x is the field number.

Or in the memberinfo
Code:
$userinfo[fieldx]
Reply With Quote
  #5  
Old 04-07-2006, 03:41 PM
libertate's Avatar
libertate libertate is offline
 
Join Date: Feb 2005
Location: Kiribati
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...

HTML Code:
...
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
<if condition="is_member_of($posts,9)">$post[field8] </if>
$post[onlinestatus]...
I double checked that the user is in group 9, still nothing displays.

If I remove the conditional, the text is displayed without a problem.

What could I be doing wrong? Does the group have to be the primary group? Is there a "set" list, where I can define a set of groups?

(Is there a central reference to all this, so I don't have to bug all of you on this for the next 2 dozen issues?)
Reply With Quote
  #6  
Old 04-08-2006, 02:13 AM
Freesteyelz's Avatar
Freesteyelz Freesteyelz is offline
 
Join Date: Jan 2006
Posts: 1,552
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I could be wrong but it looks like you're defining that if the user who posted is in Usergroup 9 then $post[field8] will show up. If yes, then anyone (logged in or not) will be able to view field8 for that particular post. It may explain why you didn't see field8.

If you want only Usergroup "9" to see "$post[field8]" then try:

Code:
<if condition="is_member_of($bbuserinfo, 9)">$post[field8]</if>
Reply With Quote
  #7  
Old 04-08-2006, 04:34 AM
libertate's Avatar
libertate libertate is offline
 
Join Date: Feb 2005
Location: Kiribati
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent! Works like a charm.

Thank you.

Where can I get some sort of a manual or details of these fields, functions, etc?
Reply With Quote
  #8  
Old 04-08-2006, 05:51 AM
Freesteyelz's Avatar
Freesteyelz Freesteyelz is offline
 
Join Date: Jan 2006
Posts: 1,552
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

NP.

Aside from vBulletin's manual I've gathered what I need from vBulletin.com. In the "How Do I..." and "Quick Tips & Custiomizations" forums you can get quite a bit of information by doing various searches. Also, a good tip is to study the vB's .php codes and various vB.org hacks as they often contain common routines.
Reply With Quote
Reply

Thread Tools
Display Modes

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:20 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.05203 seconds
  • Memory Usage 2,233KB
  • 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
  • (3)bbcode_code
  • (4)bbcode_html
  • (1)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_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