View Full Version : A "How do I" question regarding postbit.
RagingPenguin
Sun 25th May '08, 3:30pm
I want to add custom profile fields to the postbit_legacy, but I see neither a template for the $template_hook that is in the actual postbit_legacy template, nor a plugin hook that makes sense (I'm trying them all, sorry).
So how do I do this?
sockwater
Sun 25th May '08, 5:53pm
Put the following code in a plugin on the postbit_display_start hook. Enable & save the plugin.$template_hook['postbit_userinfo_left'] = 'LEFT';
$template_hook['postbit_userinfo_right_after_posts'] = 'RIGHT AFTER POSTS';
$template_hook['postbit_userinfo_right'] = 'RIGHT';Now view a post to see where those will show up. After that you can display your custom profile fields like this:$template_hook['postbit_userinfo_right'] = $post['field12'];
RagingPenguin
Mon 26th May '08, 4:20am
Smashing! Thanks! I had it all figured wrong. LOL. I was looking for a template called 'postbit_userinfo_right' ala ad_locations.
Jason Buchanan
Mon 26th May '08, 9:01pm
I am coming in on the tail end of the conversation but how would I replace left, right after post, and right with images? Is that possible?
sockwater
Tue 27th May '08, 8:54am
You mean?
$template_hook['postbit_userinfo_left'] = '<img src="PATH/TO/YOUR/IMAGE" alt="" />';
Jason Buchanan
Tue 27th May '08, 9:37pm
Can that be set to load a certain image for a usergroup id? I hate to say but I am a true rookie when it comes to this and am learning as I go. Where would I insert that code? At a certain spot in the post_bit legacy template or just anywhere?
sockwater
Tue 27th May '08, 11:59pm
Can that be set to load a certain image for a usergroup id?
if (is_member_of($vbulletin->userinfo, 13))
{
$template_hook['postbit_userinfo_left'] = '<img src="PATH/TO/YOUR/IMAGE/FOR/USERGROUP/13" alt="" />';
}
else if (is_member_of($vbulletin->userinfo, 14))
{
$template_hook['postbit_userinfo_left'] = '<img src="PATH/TO/YOUR/IMAGE/FOR/USERGROUP/14" alt="" />';
}
Where would I insert that code? At a certain spot in the post_bit legacy template or just anywhere?
See post #2.
Jason Buchanan
Wed 28th May '08, 9:00am
I have looked a post number 2 and still cannot make head or tails of where it should be placed.
sockwater
Wed 28th May '08, 1:03pm
Admin Control Panel -> Products & Products -> Add New Plugin
1. Select postbit_display_start as the hook location
2. Post the code in the code box.
3. Plugin is active: Yes.
4. Save it.
Jason Buchanan
Wed 28th May '08, 6:16pm
Cut and dry the way I like it.Thank You very much. I have added the plugin as advised and nothing has changed?
dabuki
Thu 19th Jun '08, 4:55am
using "is_member_of" in the postbit needs to have "global $vbulletin;" called at the start of the plugin, or am I wrong?
sockwater
Thu 19th Jun '08, 2:28pm
using "is_member_of" in the postbit needs to have "global $vbulletin;" called at the start of the plugin, or am I wrong?
Whatever for?
Zachery
Thu 19th Jun '08, 3:52pm
That seems like an awful lot of work for a template conditional.
<if condition="is_member_of($post, X)">code here</if>
No need to use a hook at all
sockwater
Fri 20th Jun '08, 3:26pm
That seems like an awful lot of work for a template conditional.
<if condition="is_member_of($post, X)">code here</if>
No need to use a hook at all
The reason I originally suggested using a plugin + template hooks in post #2 was to eliminate the need to be incessantly merging template changes with each update. :) Of course it can be done either way.
dabuki
Sun 22nd Jun '08, 11:20am
Quote:
Originally Posted by dabuki http://www.vbulletin.com/forum/images/buttons/viewpost.gif (http://www.vbulletin.com/forum/showthread.php?p=1582619#post1582619)
using "is_member_of" in the postbit needs to have "global $vbulletin;" called at the start of the plugin, or am I wrong?
Whatever for?
I meant you need the "global $vbulletin" in the case of "is_member_of($vbulletin->, userinfo, x) otherwise the plugin want recognize the usergroups. If you use "is_member_of($post, x) then there is no need for the "global"
sockwater
Sun 22nd Jun '08, 11:26am
Yes, that's right.
vBulletin® v3.8.0 Beta 3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.