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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2006, 02:05 PM
dutchbb dutchbb is offline
 
Join Date: Nov 2003
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default looking for conditional [if usergroupID = ... show this to all users]

Hi,

In postbit template, I need a conditional to show something to all users if usergroupID who posted it = admin, if usergroupID=moderator show something else.

Anyone knows what conditional that is?

Thanks
Reply With Quote
  #2  
Old 06-09-2006, 03:39 PM
Ntfu2 Ntfu2 is offline
 
Join Date: Feb 2006
Posts: 1,247
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a basic one for you

Code:
 <if condition="$bbuserinfo[usergroupid] == XX"> 
CHANGE XX TO ADMIN USER GROUP
</if>
 <if condition="$bbuserinfo[usergroupid] == X"> 
CHANGE X TO MODERATOR USER GROUP
</if>
Reply With Quote
  #3  
Old 06-09-2006, 03:46 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm thinking he meant the posters group, not the viewers group is the trigger.

Anywho, I don't think the poster group in in there, but ya can make a hook and preprocess with something like...

if( is_member_of(6,$post[userid]) ) $is_admin = true;
if( is_member_of(7,$post[userid])) $is_mod = true;

There may be better ways.
Reply With Quote
  #4  
Old 06-09-2006, 04:53 PM
dutchbb dutchbb is offline
 
Join Date: Nov 2003
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ntfu2
Here is a basic one for you

Code:
 <if condition="$bbuserinfo[usergroupid] == XX"> 
CHANGE XX TO ADMIN USER GROUP
</if>
 <if condition="$bbuserinfo[usergroupid] == X"> 
CHANGE X TO MODERATOR USER GROUP
</if>
That's not what I meant, I use that one all the time.

But I need the one where in the posters post (based on usergroups) it shows something only in their posts.

Thanks anyway.

Quote:
Originally Posted by noppid
I'm thinking he meant the posters group, not the viewers group is the trigger.

Anywho, I don't think the poster group in in there, but ya can make a hook and preprocess with something like...

if( is_member_of(6,$post[userid]) ) $is_admin = true;
if( is_member_of(7,$post[userid])) $is_mod = true;

There may be better ways.
I don't understand that but thanks anyway.
Reply With Quote
  #5  
Old 06-09-2006, 05:05 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the showthread_postbit_create hook put the code.

PHP Code:
$is_admin false;
$is_mod false;
if( 
is_member_of($post,6) ) $is_admin true;
if( 
is_member_of($post,7) ) $is_mod true
In the postbit template put.

PHP Code:
<if condition="$is_admin"
CHANGE XX TO ADMIN USER GROUP
</if>
 <if 
condition="$is_mod"
CHANGE X TO MODERATOR USER GROUP
</if> 
This is not tested, but the first post was wrong completely.
Reply With Quote
  #6  
Old 06-09-2006, 05:07 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
In the showthread_postbit_create hook put the code.

PHP Code:
$is_admin false;
$is_mod false;
if( 
is_member_of(6,$post[userid]) ) $is_admin true;
if( 
is_member_of(7,$post[userid]) ) $is_mod true
In the postbit template put.

PHP Code:
<if condition="$is_admin"
CHANGE XX TO ADMIN USER GROUP
</if>
 <if 
condition="$is_mod"
CHANGE X TO MODERATOR USER GROUP
</if> 

Why not just do this?
Code:
<if condition="is_member_of(6,$post[userid])">
Something here
</if>

<if condition="is_member_of(7,$post[userid]">
Something here
</if>
Reply With Quote
  #7  
Old 06-09-2006, 05:28 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Because I forgot I can run that function in the template. DOH!

Thanks

P.S. My code does work though. I wonder which is more processing, the hook code parsing or the template code parsing? Or if it may even matter. It's nice to know the overhead and code around it if ya can, but I have nothing to go by.
Reply With Quote
  #8  
Old 06-09-2006, 06:30 PM
dutchbb dutchbb is offline
 
Join Date: Nov 2003
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
In the showthread_postbit_create hook put the code.

PHP Code:
$is_admin false;
$is_mod false;
if( 
is_member_of($post,6) ) $is_admin true;
if( 
is_member_of($post,7) ) $is_mod true
In the postbit template put.

PHP Code:
<if condition="$is_admin"
CHANGE XX TO ADMIN USER GROUP
</if>
 <if 
condition="$is_mod"
CHANGE X TO MODERATOR USER GROUP
</if> 
This is not tested, but the first post was wrong completely.
hm

Fatal error: Only variables can be passed by reference in /home/account/domains/mydomain.com/public_html/forum/showthread.php(1031) : eval()'d code on line 19

Quote:
Originally Posted by gio~logist
Why not just do this?
Code:
<if condition="is_member_of(6,$post[userid])">
Something here
</if>

<if condition="is_member_of(7,$post[userid]">
Something here
</if>
Strange, when I try to save that code my page turns white, nothing happens and nothing gets saved???

Andreas posted the right conditional for this purpose once but I cant find his post anymore

Ok basically what I want to achieve is this: https://vborg.vbsupport.ru/showthrea...30#post1003930
Reply With Quote
  #9  
Old 06-11-2006, 12:14 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

You should actually use ;

HTML Code:
<if condition="is_member_of($post,6)">
Something here (if poster is in admin group)
</if>
Also, you can specify more than one group, e.g.

HTML Code:
<if condition="is_member_of($post,5,6,7)">
Something here (if poster is in group 5, 6 or 7)
</if>
Reply With Quote
  #10  
Old 06-11-2006, 01:27 PM
dutchbb dutchbb is offline
 
Join Date: Nov 2003
Posts: 899
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great thanks Paul!
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:08 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.04267 seconds
  • Memory Usage 2,271KB
  • 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
  • (4)bbcode_code
  • (2)bbcode_html
  • (6)bbcode_php
  • (5)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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete