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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2010, 12:00 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugins for Forum Postbit generate errors in CMS?

I adapted the Latest Blog Using Carp add-on to vB4 here: https://vborg.vbsupport.ru/showthread.php?t=234254

At the time, I was using only the Forum (CMS and Blog disabled in the Suite) and it worked fine, displaying the title of the latest (external) blog feed in the postbit for any forum post by that member.

The add-on uses two small plug-ins:

1. Carp Configuration, attached to the "global_start" hook location (I realize this should now be changed to global_bootstrap_init_start but doing that makes no difference - I still get the errors).

PHP Code:
require_once '/path/to/forum/carp/carp.php';
CarpConf('carperrors',0);
CarpConf('cacheinterval',120);
/** You may want to set a cachepath specifically for your forum **/
/** CarpConf('cachepath','/path/to/carp_cache/'); **/
/** CarpConf('cacherelative',0); **/
/** You can omit the above two lines without a problem **/
CarpConf('cborder','');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('iorder','link');
CarpConf('linktarget',1); 

2. Get Users Blog Entry, attached to postbit_display_start

PHP Code:
ob_start();
CarpCacheShow($post[field6]);
$blogentry ob_get_contents();
ob_end_clean();
vB_Template::preRegister('postbit',array('blogentry' => $blogentry)); 
When I enable CMS, however, I get errors like this depending on which hook I attach the two plgins to:

Quote:
Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21
The thing is that this should only function for forum posts anyway. It isn't needed in CMS (or the vBulletin Blog for that matter although I haven't enabled that yet). For me, the errors are seen whenever I try to edit the CMS article or add or edit a comment. Another user who has this installed reported the same problems.

What do I need to do to eliminate these errors?
Reply With Quote
  #2  
Old 08-17-2010, 03:39 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you only want it to work on the showthread page, then wrap the plugin at the global_start location with a THIS_SCRIPT == 'showthread' condition otherwise it is evaled on every single page.
Reply With Quote
  #3  
Old 08-17-2010, 04:03 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tried this:

PHP Code:
if (THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'showpost')
{
require_once 
'/path/to/forum/carp/carp.php'
CarpConf('carperrors',0); 
CarpConf('cacheinterval',120); 
/** You may want to set a cachepath specifically for your forum **/ 
/** CarpConf('cachepath','/path/to/carp_cache/'); **/ 
/** CarpConf('cacherelative',0); **/ 
/** You can omit the above two lines without a problem **/ 
CarpConf('cborder',''); 
CarpConf('poweredby',''); 
CarpConf('maxitems',1); 
CarpConf('iorder','link'); 
CarpConf('linktarget',1);  
}; 

Error:

Quote:
Fatal error: Call to undefined function CarpCacheShow() in /path/to/forum/includes/class_postbit.php(284) : eval()'d code on line 13
And if I wrap both plugins in that conditional, I get:

Quote:
Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21
Reply With Quote
  #4  
Old 08-17-2010, 03:10 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And where is that function defined? You need to include that file with the function also.
Reply With Quote
  #5  
Old 08-17-2010, 04:15 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What function? I've shown you the entire contents of the plug-ins. The only additional code is in postbit which displays the custom field:

PHP Code:
<!-- latest blog hack for members in good standing only -->
<
vb:if condition="!in_array($bbuserinfo[usergroupid],array(2,20,22,28,30))">
<
vb:if condition="$post['field6']">
<!-- <
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw blogentry}</a></span> -->
<
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw post[field7]}</a></span>
</
vb:if>
</
vb:if>
<!-- 
end latest blog hack for members in good standing only --> 

The referenced line 13 in class_postbit.php in the first error is:

Code:
if (!isset($GLOBALS['vbulletin']->db))
The referenced line 21 in class_postbit.php in is:

Code:
require_once(DIR . '/includes/class_bbcode.php');
Reply With Quote
  #6  
Old 08-19-2010, 02:22 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm still unable to get this to stop throwing errors in CMS.

Any suggestions on how to proceed to locate the source of the errors?
Reply With Quote
  #7  
Old 08-19-2010, 02:32 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djbaxter View Post
What function? I've shown you the entire contents of the plug-ins. The only additional code is in postbit which displays the custom field:

PHP Code:
<!-- latest blog hack for members in good standing only -->
<
vb:if condition="!in_array($bbuserinfo[usergroupid],array(2,20,22,28,30))">
<
vb:if condition="$post['field6']">
<!-- <
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw blogentry}</a></span> -->
<
span class="smallfont">Recent Blog: <a href="{vb:raw post[field8]}" target="_blank">{vb:raw post[field7]}</a></span>
</
vb:if>
</
vb:if>
<!-- 
end latest blog hack for members in good standing only --> 
The referenced line 13 in class_postbit.php in the first error is:

Code:
if (!isset($GLOBALS['vbulletin']->db))
The referenced line 21 in class_postbit.php in is:

Code:
require_once(DIR . '/includes/class_bbcode.php');
That's actually not how you read the error.
Code:
Fatal error: Call to undefined function CarpCacheShow() in  /path/to/forum/includes/class_postbit.php(284) : eval()'d code on line  13
That means, look at line 284 of class_postbit.php which is calling something which then has a problem on line 13. So, line 284 of class_postbit.php is this:
PHP Code:
($hook vBulletinHook::fetch_hook('postbit_display_start')) ? eval($hook) : false
The problem is with line 13 of something being called by that hook location.

But look at the error... "Call to undefined function CarpCacheShow()" A function is being called that doesn't exist on that page. That is why I asked where the function is defined. Cuz wherever that is, you need to make sure that file is included at that point.


Quote:
Originally Posted by djbaxter View Post
I'm still unable to get this to stop throwing errors in CMS.

Any suggestions on how to proceed to locate the source of the errors?
You need to do something to make sure those plugins are not called on the CMS page (which is why I was suggesting using THIS_SCRIPT)
Reply With Quote
  #8  
Old 08-19-2010, 02:46 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But see above: I tried using the conditional for THIS_SCRIPT and that didn't help.

Quote:
But look at the error... "Call to undefined function CarpCacheShow()" A function is being called that doesn't exist on that page. That is why I asked where the function is defined. Cuz wherever that is, you need to make sure that file is included at that point.
The function is defined in the second plugin, Get Users Blog Entry, attached to postbit_display_start:

PHP Code:
ob_start(); 
CarpCacheShow($post[field6]); 
$blogentry ob_get_contents(); 
ob_end_clean(); 
vB_Template::preRegister('postbit',array('blogentry' => $blogentry)); 
It simply pulls the information from field6.
Reply With Quote
  #9  
Old 08-19-2010, 02:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think I'm misunderstanding something here. You say when you enable the CMS you get those errors, I had assumed you meant on the CMS page, but think I'm wrong. *What* exact page are you getting the errors on?

Are you sure $post[field6] is valid? Try entering something else and see if it works.

And this is not valid - {vb:raw post[field7]} - it's {vb:raw post.field7}
Reply With Quote
  #10  
Old 08-19-2010, 03:05 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I think I'm misunderstanding something here. You say when you enable the CMS you get those errors, I had assumed you meant on the CMS page, but think I'm wrong. *What* exact page are you getting the errors on?
The errors occur when I try to edit a CMS article or when someone enters a comment.

Quote:
Originally Posted by Lynne View Post
Are you sure $post[field6] is valid? Try entering something else and see if it works.
Yes, it's valid. Doublechecked.

Quote:
Originally Posted by Lynne View Post
And this is not valid - {vb:raw post[field7]} - it's {vb:raw post.field7}
OK, I'll change that, although it doesn't seem likely that's creating the errors, does it?

--------------- Added [DATE]1282234229[/DATE] at [TIME]1282234229[/TIME] ---------------

Examples of pages with errors:

http://forum.psychlinks.ca/content.p...ew-server/edit

Quote:
Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21
http://forum.psychlinks.ca/content/2...ml#new_comment

Quote:
Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21T

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21

Warning: Invalid argument supplied for foreach() in [path]/includes/class_postbit.php(321) : eval()'d code on line 21
--------------- Added [DATE]1282235618[/DATE] at [TIME]1282235618[/TIME] ---------------

OK. The errors also show on the actual article page: e.g., http://forum.psychlinks.ca/content/2...ew-server.html

They do NOT show on the CMS Home page.

Other information:

Reported elsewhere and still no fix yet for this - it just occurred to me that it might be related rather than a separate issue: Articles created or promoted from forum threads show as Unpublished although all the correct checks are there to make it Published.
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 12:33 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.05040 seconds
  • Memory Usage 2,305KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_code
  • (7)bbcode_php
  • (11)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete