View Full Version : looking for conditional [if usergroupID = ... show this to all users]
dutchbb
06-08-2006, 02:05 PM
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 ;)
<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
Here is a basic one for you ;)
<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.
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.
$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.
<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
In the showthread_postbit_create hook put the 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.
<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?
<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
In the showthread_postbit_create hook put the 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.
<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
Why not just do this?
<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/showthread.php?p=1003930#post1003930
Paul M
06-11-2006, 12:14 PM
You should actually use ;
<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.
<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
darnoldy
06-11-2006, 07:44 PM
<if condition="is_member_of($post,6">
Something here (if poster is in admin group)
</if>
<if condition="is_member_of($post,5,6,7">
Something here (if poster is in group 5, 6 or 7)
</if>No ending paren?
--don
Paul M
06-11-2006, 07:46 PM
No ending paren?
--don
Yes, obviously a typo.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.