The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How to use is_member_of in template postbit
I tried code in template postbit_legacy:
Code:
<vb:if condition="is_member_of($post, 5,6,7)">code here</vb:if> Code:
<vb:if condition="is_member_of($post, $vboptions['select_groupid'])"> p/s: i tried Code:
is_member_of($bbuserinfo,....) Code:
is_member_of($post['usergroupid'],....) |
#2
|
|||
|
|||
Is $vboptions['select_groupid'] a string with comma separated group ids? Then maybe this:
Code:
<vb:if condition="is_member_of($post, explode(',', $vboptions['select_groupid']))"> |
#3
|
||||
|
||||
i tried but errror
|
#4
|
|||
|
|||
Oh, right. My bad. Like the message says, you're not allowed to use that function in a template condition. I think you'll need to create a plugin to do it. Maybe use hook location postbit_display_complete and use the $show[] variable, with code like:
Code:
$show['some_unique_name'] = is_member_of($post, explode(',', $vbulletin->options['select_groupid'])); and then in the template Code:
<vb:if condition="$show['some_unique_name']">code here</vb:if> (of course you'd pick something else for 'some_unique_name'). |
#5
|
||||
|
||||
I tried but dont work, this is my plugin:
Code:
<plugin active="1" executionorder="5"> <title>Demo</title> <hookname>postbit_display_complete</hookname> <phpcode><![CDATA[global $vbulletin; $show['hidehack'] = is_member_of($post, explode(',', $vbulletin->options['select_groupid'])); ]]></phpcode> </plugin> Code:
<vb:if condition="$show['hidehack']">code here</vb:if> |
#6
|
|||
|
|||
OK, I tried this plugin code:
Code:
global $vbulletin; $vbulletin->options['select_groupid'] = "5, 6, 7"; $show['hidehack'] = is_member_of($post, explode(',', $vbulletin->options['select_groupid'])); Code:
<vb:if condition="$show['hidehack']">Hidehack<vb:else />No</vb:if> and that seems to work. So maybe you should try to see what your option string it set to. Maybe temporarily put $vboptions[select_groupid] in the template and see what's displayed? |
#7
|
||||
|
||||
done , thank you so much!
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|