The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Plugin not parsing variables
Hi, i've created a plugin with the following code
HTML Code:
$template_hook[postbit_user_popup].='<if condition="in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14))"> <if condition="is_member_of($vbulletin->userinfo, array( 5,6,7))"> <tr><td class="vbmenu_option"><a href="iptest.php?domain=$post[ip]">WhoisIP for $post[username]: $post[ip]</a></td></tr> </if></if>'; I am using postbit_display_complete as the hook location (and i've tried others) so i don't understand why those aren't getting the data, if i code it by hand in the postbit template it works fine? Any suggestions would be welcome. |
#2
|
|||
|
|||
A template hook has to be html, it doesn't get processed like a template. (I believe you would see the if tags unprocessed if you viewed the page source). And your vars didn't get processed because you have the string in single quotes.
So you could do this: Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14)) AND is_member_of($vbulletin->userinfo, array( 5,6,7))) { $template_hook[postbit_user_popup].= "<tr><td class=\"vbmenu_option\"><a href=\"iptest.php?domain=$post[ip]\">WhoisIP for $post[username]: $post[ip]</a></td></tr>"; } assuming the values of $post are set at that point in the code. |
#3
|
||||
|
||||
Thanks for the code and the info, would the AND be correct? the first IF is which groups the item can be seen/used on the second gives the permission for who can see and use it.
EDIT: Your code gives: Parse error: syntax error, unexpected T_STRING in /home/thecodec/public_html/testforum/includes/class_postbit.php(294) : eval()'d code on line 3 |
#4
|
|||
|
|||
Quote:
Quote:
|
#5
|
||||
|
||||
Err, wish i knew what you meant there!, using your amended code the item doesn't display in the postbit userinfo dropdown.
Thanks for your help here --------------- Added [DATE]1306724900[/DATE] at [TIME]1306724900[/TIME] --------------- This works but im sure i've lost control over it somewhere as i should be able to choose which usergroups it will be available for then which ones can actually use it HTML Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14))) { $template_hook[postbit_user_popup].= "<tr><td class='vbmenu_option'><a href='iptest.php?domain=$post[ip]'>WhoisIP for $post[username]: $post[ip]</a></td></tr>"; } |
#6
|
|||
|
|||
Just that there's more than one way to address that issue, but it doesn't matter.
Quote:
|
#7
|
||||
|
||||
I tried this
HTML Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14)) AND $this->registry->userinfo in the is_member_of(5,6,7))) { $template_hook[postbit_user_popup].= "<tr><td class=\"vbmenu_option\"><a href=\"iptest.php?domain=$post[ip]\">WhoisIP for $post[username]: $post[ip]</a></td></tr> </if></if>"; } --------------- Added [DATE]1306726547[/DATE] at [TIME]1306726547[/TIME] --------------- Lol, it's 4:30am here and i wasn't reading it properly, this works HTML Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14)) AND is_member_of($this->registry->userinfo, array( 5,6,7))) { $template_hook[postbit_user_popup].= "<tr><td class=\"vbmenu_option\"><a href=\"iptest.php?domain=$post[ip]\">WhoisIP for $post[username]: $post[ip]</a></td></tr> </if></if>"; } |
#8
|
|||
|
|||
Sorry, i meant like this:
Code:
if (in_array($post[usergroupid], array( 1,2,3,4,5,6,7,8,9,10,11,12,13,14)) AND is_member_of($this->registry->userinfo, array(5,6,7))) { $template_hook[postbit_user_popup].= "<tr><td class=\"vbmenu_option\"><a href=\"iptest.php?domain=$post[ip]\">WhoisIP for $post[username]: $post[ip]</a></td></tr>"; } Quote:
|
#9
|
||||
|
||||
Brilliant thanks, i can now complete my very first product, so im going to update my vb3.8.x Add-on https://vborg.vbsupport.ru/showthread.php?t=264283 and make it easier for folk rather than template edits, i'll add that in the next 5 mins or so, fancy giving it a go for me?
|
#10
|
|||
|
|||
I tried it and it works, nice job! However there's a slight problem with the xml file, something to do with the version check url on line 8. I just deleted that from the xml to test it, I'm sure it's something minor.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|