vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Plugin and/or php code not working (https://vborg.vbsupport.ru/showthread.php?t=232673)

Mythotical 01-10-2010 03:17 AM

Plugin and/or php code not working
 
I have a plugin at global_start:
PHP Code:

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:
HTML Code:

$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 [DATE]1263179897[/DATE] at [TIME]1263179897[/TIME] ---------------

Here are the plugins:

usergroup permissions - global_start - Excution Order = 2:
PHP Code:

$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:
PHP Code:

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 [DATE]1263200185[/DATE] at [TIME]1263200185[/TIME] ---------------

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.


All times are GMT. The time now is 12:13 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01160 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete