PDA

View Full Version : Plugin and/or php code not working


Mythotical
01-10-2010, 03:17 AM
I have a plugin at global_start:
if($canviewquote AND $vbulletin->options['pl9_qloc2'] == 'above_navbar'){
$find = '<!-- breadcrumb, login, pm info -->';
$replace = '$quote';

$vbulletin->templatecache['navbar'] = str_replace($find,$replace.$find,$vbulletin->templatecache['navbar']);
} else if($canviewquote AND $vbulletin->options['pl9_qloc2'] = 'below_forum'){
$find2 = '$ad_location[ad_footer_start]';
$replace2 = '<br />$quote';
$vbulletin->templatecache['footer'] = str_replace($replace2,$find2.$replace2,$vbulletin->templatecache['footer']);
}

eval('$template_hook[usercp_navbar_bottom] .= "<if condition="$canviewquote AND $vboptions[\'pl9_qloc2\'] == \'below_navbar\'">$quote</if>";');

Now what I don't get is why the template_hook is working perfect when I select below_navbar to display the box but if I select below_forum or above_navbar it won't work. I have changed it to reflect if condition in the plugin as well in the template replace line.

If you can see anything wrong with how I did my code please let me know.

kh99
01-10-2010, 05:54 AM
I don't know if it's the only cause of the problems, but in the "if" where you check for 'below_forum', you have a single = instead of ==.

Mythotical
01-10-2010, 07:05 AM
Yeah I changed that to see if maybe a single = would work but still didn't work.

kh99
01-10-2010, 04:46 PM
I don't see anything else wrong - are you sure $vbulletin and $canviewquote are in scope?

Lynne
01-10-2010, 05:07 PM
You've got something wrong in your code because if you put these lines at the beginning, it works just fine:
$vbulletin->options['pl9_qloc2'] = 'above_navbar';
$canviewquote = true;
So, it looks like your variables are not getting defined prior to this plugin.

Mythotical
01-10-2010, 07:19 PM
Hmmm, Lynne, I am willing to post the plugins and templates, so give me a few to get those rounded up that pertain to that plugin.

kh99: Yeah I am sure they are in scope but can't figure what is going on why they are not working.

--------------- Added 1263179897 at 1263179897 ---------------

Here are the plugins:

usergroup permissions - global_start - Excution Order = 2:
$canaddquote = $permissions['bfc_quote'] & $vbulletin->bf_ugp['bfc_quote']['canaddquote'];
$candeleteown = $permissions['bfc_quote'] & $vbulletin->bf_ugp_bfc_quote['candeleteown'];
$candeleteothers = $permissions['bfc_quote'] & $vbulletin->bf_ugp_bfc_quote['candeleteothers'];
$canviewquote = $permissions['bfc_quote'] & $vbulletin->bf_ugp_bfc_quote['canviewquote'];

quote box template hooks - global_start - Execution Order = 5:
if($canviewquote AND $vbulletin->options['pl9_qloc2'] == 'above_navbar'){
$find = '<!-- breadcrumb, login, pm info -->';
$replace = '$quote';

$vbulletin->templatecache['navbar'] = str_replace($find,$replace.$find,$vbulletin->templatecache['navbar']);
} else if($canviewquote AND $vbulletin->options['pl9_qloc2'] = 'below_forum'){
$find2 = '$ad_location[ad_footer_start]';
$replace2 = '<br />$quote';
$vbulletin->templatecache['footer'] = str_replace($replace2,$find2.$replace2,$vbulletin->templatecache['footer']);
}

eval('$template_hook[usercp_navbar_bottom] .= "<if condition="$canviewquote AND $vboptions[\'pl9_qloc2\'] == \'below_navbar\'">$quote</if>";');

That covers everything that deals with the display of quotes and delete link when viewing a members profile.

--------------- Added 1263200185 at 1263200185 ---------------

Ok so I might have a resolution to this but I won't know until I test it out after some sleep. I love when I find old mods that actually used similar code and worked.