vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   What is the if condition= for group & logged in? (https://vborg.vbsupport.ru/showthread.php?t=112328)

libertate 04-06-2006 06:46 PM

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?

Paul M 04-06-2006 06:55 PM

HTML Code:

<if condition="is_member_of($posts,2)"> do something </if>
Where 2 is the usergroupid.

libertate 04-07-2006 01:08 PM

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>

peterska2 04-07-2006 01:30 PM

In the postbit
Code:

$post[fieldx]
where x is the field number.

Or in the memberinfo
Code:

$userinfo[fieldx]

libertate 04-07-2006 03:41 PM

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

Freesteyelz 04-08-2006 02:13 AM

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>

libertate 04-08-2006 04:34 AM

Excellent! Works like a charm.

Thank you.

Where can I get some sort of a manual or details of these fields, functions, etc?

Freesteyelz 04-08-2006 05:51 AM

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


All times are GMT. The time now is 07:09 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.01102 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete