vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   looking for conditional [if usergroupID = ... show this to all users] (https://vborg.vbsupport.ru/showthread.php?t=118022)

dutchbb 06-08-2006 02:05 PM

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

Ntfu2 06-09-2006 03:39 PM

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>


noppid 06-09-2006 03:46 PM

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.

dutchbb 06-09-2006 04:53 PM

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.

noppid 06-09-2006 05:05 PM

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.

Gio~Logist 06-09-2006 05:07 PM

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>


noppid 06-09-2006 05:28 PM

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.

dutchbb 06-09-2006 06:30 PM

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

Paul M 06-11-2006 12:14 PM

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>


dutchbb 06-11-2006 01:27 PM

Great thanks Paul! :D


All times are GMT. The time now is 06:26 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.01169 seconds
  • Memory Usage 1,765KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_html_printable
  • (6)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete