The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Hooks
So I've made a postbit background plugin, which will give certain usergroups a background. It works in my threads, but it's not reading the plugin, or something properly from PM's. I'm guessing it's something with the hook location.
So I'm here to ask what hook location should I use? My current hook location: postbit_display_start |
#2
|
|||
|
|||
I think the problem is that $this->post['usergroupid'] is not set if it's a pm (and so you can't use is_member_of(), if that's what you're doing). I don't think there's anything you can do except do a query for it yourself if you're displaying a PM. Maybe something like:
Code:
if (get_class() == 'vB_Postbit_Pm') { $userinfo = fetch_userinfo($this->post['userid']); } else { $userinfo &= $this->post; } // then use $userinfo to check group... |
#3
|
|||
|
|||
Quote:
So I'm still having a feeling it's something with the hooks. |
#4
|
||||
|
||||
Are you using debug mode to view the hooks called on each page and have you verified that the hook you are using is being called on the PM page you are looking at?
|
#5
|
|||
|
|||
So what does happen? Seems like if it's changing the background then the plugin must be running.
|
#6
|
|||
|
|||
Quote:
Code:
if (1==2) //<div class="userinfo" style="background: green;"> else //<div class="userinfo"> Lynne, that's what I think is wrong. The hook location is wrong and is not being called on the page. How can I turn debug mode on to check which hooks --------------- Added [DATE]1351013884[/DATE] at [TIME]1351013884[/TIME] --------------- Okay so I enabled debug mode. postbit_display_start, which is the hook I've been using is enabled in both pages. So I'm still a little confused, I'll try making just something that prints out something to test it. --------------- Added [DATE]1351013967[/DATE] at [TIME]1351013967[/TIME] --------------- Nope, I made it output 'Hello', it works in the threads, but still messes up my PM. Weird.. |
#7
|
||||
|
||||
How about you post the exact php code and hook location so we can try it on our own.
|
#8
|
|||
|
|||
Plugin hook: postbit_display_start
Code: Code:
ob_start(); $usergroupid = $post['usergroupid']; $has_bg = array(6); if (in_array($usergroupid, $has_bg)) { echo '<div class="userinfo" style="background:url(images/ranks/postbit/'.$usergroupid.'.png);min-height: 350px;">'; } else { echo '<div class="userinfo">'; } $php_include = ob_get_contents(); ob_end_clean(); vB_Template::preRegister('postbit_legacy',array('postbit_background' => $php_include)); Code:
<div class="userinfo"> Code:
{vb:raw postbit_background} |
#9
|
||||
|
||||
You can look at the query around line 1611 or private.php and see that the usergroupid is never even grabbed, as Kevin had brought up above. You would need to modify the query to add that in.
|
#10
|
|||
|
|||
No, I'm not worried about that postbit backgrounds actually working with the PM's atm, the problem is, the actual plugin is not being called. If it were being called, it would just show <div class="userinfo">, which it's not.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|