View Full Version : How to access $template_hook[postbit_userinfo_left] ?
0ptima
08-05-2007, 09:53 PM
The $template_hook[postbit_userinfo_left] hook in the postbit_legacy seems like a good place to add some member badges, but how do you use it?
I went to "Add new plugin", and under the "Hook Location", I dont see this hook. The only postbit hooks I see are:
postbit_dispaly_start
postbit_dispaly_complete
postbit_attachement
postbit_imicons
I just upgraded from 3.6.4 -> 3.6.8
EnIgMa1234
08-05-2007, 10:12 PM
You do it using plugins. Check the articles section for a tutorial on template hooks
0ptima
08-12-2007, 04:44 PM
Thanks, I finally figured out how to get the template to execute. Now I having problems with the following code
$template_hook[postbit_userinfo_right_after_posts] .= '
<if condition="$post['userid']"><div>iTrader: (<b><a href="itrader.php?$session[sessionurl]u=$post[userid]">$post[itrader_total]</a></b>)</div></if> ';
This gives me a parse error.
Opserty
08-12-2007, 05:21 PM
Take out the apostrophes in $post['userid']
i.e. $post[userid] :p
EnIgMa1234
08-12-2007, 06:19 PM
Apostrophes in plugins
None in templates ;)
Try changing
$post[itrader_total]
To
$post['itrader_total']
Opserty
08-12-2007, 06:21 PM
Read his code again :p
Did you miss the syntax highlighting as well? hehe
EnIgMa1234
08-12-2007, 06:23 PM
Oh yea my bad :p
0ptima
08-14-2007, 12:21 AM
Still does not work.. even after I removed all the quotes...
EnIgMa1234
08-14-2007, 09:03 AM
So you have
$template_hook['postbit_userinfo_right_after_posts'] .= '
<if condition="$post[userid]"><div>iTrader: (<b><a href="itrader.php?$session[sessionurl]u=$post[userid]">$post[itrader_total]</a></b>)</div></if> ';
0ptima
08-14-2007, 11:30 PM
So you have
$template_hook['postbit_userinfo_right_after_posts'] .= '
<if condition="$post[userid]"><div>iTrader: (<b><a href="itrader.php?$session[sessionurl]u=$post[userid]">$post[itrader_total]</a></b>)</div></if> ';
That does not work either...
King Kovifor
08-14-2007, 11:46 PM
Do it under the hook "Parse Templates", and use eval() codes.
I believe this is the structure:
eval("$template_hook['userinfo_postbit_left'] .= '" . fetch_template('template name') . "':");
That should do the trick. Just add your code into a template. Templates are the best and easiest way to go within template hooks.
0ptima
08-15-2007, 01:28 AM
Do it under the hook "Parse Templates", and use eval() codes.
I believe this is the structure:
eval("$template_hook['userinfo_postbit_left'] .= '" . fetch_template('template name') . "':");That should do the trick. Just add your code into a template. Templates are the best and easiest way to go within template hooks.
that did not work either.... :(
Opserty
08-15-2007, 11:05 AM
What error are you getting now? (Copy and Paste it)
Or is just not showing up?
0ptima
08-16-2007, 12:05 AM
This is my plugin code
eval("$template_hook['postbit_userinfo_right_after_posts'] .= '" . fetch_template('CustomPostbit') . "':");
The hook location is parse_templates
I have the following in my custom template
<if condition="$post[userid]"><div>iTrader: (<b><a href="itrader.php?$session[sessionurl]u=$post[userid]">$post[itrader_total]</a></b>)</div></if>
I get the following error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/website/public_html/forums/global.php(554) : eval()'d code on line 7
Thanks.
Opserty
08-16-2007, 07:05 AM
No wonder...you have a colon before the final speech mark. Change it to a semi-colon and it should work. :)
Here:
eval("$template_hook['postbit_userinfo_right_after_posts'] .= '" . fetch_template('CustomPostbit') . "';");
0ptima
08-16-2007, 11:27 PM
Even with the change, I still get the error. Are the quotes in the right place?
Opserty
08-17-2007, 09:08 AM
First try this:
eval('$template_hook[postbit_userinfo_right_after_posts] .= "' . fetch_template('CustomPostbit') . '";');
If still not try this:
eval('$template_hook[\'postbit_userinfo_right_after_posts\'] .= "' . fetch_template('CustomPostbit') . '";');
Finally are you running any other plugins? :p
If things don't start working trial and error is the way to go haha.
0ptima
08-19-2007, 01:00 AM
None gave me errors but non worked :(
sinisterpain
08-19-2007, 02:58 AM
$template_hook['postbit_userinfo_right'] .= '
<if condition="$post[userid]"><div>iTrader: <a href="itrader.php?' . $session['sessionurl'] . 'u= ' . $post['userid'] . '">' . $post['itrader_total'] . '</a></div></if> ';
not tested
0ptima
08-19-2007, 06:15 PM
$template_hook['postbit_userinfo_right'] .= '
<if condition="$post[userid]"><div>iTrader: <a href="itrader.php?' . $session['sessionurl'] . 'u= ' . $post['userid'] . '">' . $post['itrader_total'] . '</a></div></if> ';
not tested
:up: Thank you it works!!!!!!!
I also want to thank everyone that helped me as well!!! :)
sinisterpain
08-19-2007, 11:26 PM
:up: Thank you it works!!!!!!!
I also want to thank everyone that helped me as well!!! :)
Your welcome glade I could help
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.