ManOnDaMoon
Well-known member
I'm currently working on a separate script connected to my XF installation using the code from this post http://xenforo.com/community/threads/how-to-create-a-bridge.28515/#post-332370
It runs quite well except for one particular thing: the code event listeners I set up (especially in order to extend XenForo_Model_XXXX) do not seem to fire. Instead, I get an error
each time I try to access one of my custom functions.
NB: The code events fire totally fine (i.e.: I'm able to access my member functions) when I create an instance from within XF script. The problem is only within my bridge script.
I finally managed to get my own listeners working by adding them manually via this line of code, added just below the previous block:
This is fine for listeners I am aware of, but it is not suitable in cases where other addons modify a function behaviour.
Where should I have a look in order to fix this issue?
PHP:
// Include custom libraries and initialization code here
// How to use XenForo Objects: Once initialized the below you can use XenForo objects
define('XF_ROOT', MY_SCRIPT_PATH . '/path/to/xf/root/');
define('TIMENOW', time());
define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed
require_once(XF_ROOT . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT . '/library');
XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
XenForo_Application::set('page_start_time', TIMENOW);
XenForo_Application::disablePhpErrorHandler();
XenForo_Session::startPublicSession();
error_reporting(E_ALL & ~E_NOTICE); // Turn off the strict error reporting.
It runs quite well except for one particular thing: the code event listeners I set up (especially in order to extend XenForo_Model_XXXX) do not seem to fire. Instead, I get an error
Code:
Call to undefined method XenForo_Model_XXX::YYY()
NB: The code events fire totally fine (i.e.: I'm able to access my member functions) when I create an instance from within XF script. The problem is only within my bridge script.
I finally managed to get my own listeners working by adding them manually via this line of code, added just below the previous block:
PHP:
XenForo_CodeEvent::addListener('load_class_model', array('My_Listeners_Class', 'listenerCallback'));
Where should I have a look in order to fix this issue?