Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2010, 03:17 AM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 01-10-2010, 05:54 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ==.
Reply With Quote
  #3  
Old 01-10-2010, 07:05 AM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah I changed that to see if maybe a single = would work but still didn't work.
Reply With Quote
  #4  
Old 01-10-2010, 04:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't see anything else wrong - are you sure $vbulletin and $canviewquote are in scope?
Reply With Quote
  #5  
Old 01-10-2010, 05:07 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 01-10-2010, 07:19 PM
Mythotical Mythotical is offline
 
Join Date: Jun 2004
Location: Booneville, AR, USA
Posts: 1,428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:05 PM.


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.03870 seconds
  • Memory Usage 2,227KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_html
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete