View Issue Details

IDProjectCategoryView StatusLast Update
0012629mantisbtplug-inspublic2024-06-09 11:09
Reportercas Assigned Todregad  
Status closedResolutionno change required 
Product Version1.2.4 
Summary0012629: Conditions in the init routine of plugin fail

In my plugin I wanted activate an event based upon config of the plugin.
However, i end up with a error message like:
Fatal error: Call to undefined function auth_is_user_authenticated() in D:\xampp\htdocs\m120\core\config_api.php on line 84

The code I use is:
$showmenu = plugin_config_get( 'tasks_show_menu' );
if (ON == $showmenu){
plugin_event_hook( 'EVENT_MENU_MAIN', 'tasks_menu1' );
} else {
plugin_event_hook( 'EVENT_MYVIEW', 'tasks_view' );

Is there a correct option to achieve this behavior?

Additional Information

I also tried to have this setting in config_inc.php by having the following line:
$showmenu = config_get( 'tasks_show_menu' );

This gave exactly the same result.

I have tried both within the init routine and hook routine, again same result.

TagsNo tags attached.




2011-01-03 11:10

reporter   ~0027785

Still have this issue.
If i use a statement like:
if (5<0) {
all works fine.
Refering to (plugin_)config_get just returns a blank screen or the error message as mentioned above.
Can someone shed some light on this issue?



2011-01-31 05:59

reporter   ~0028120

Can this issue be acknowledged as indeed to be an issue or am I overseeing something here?



2011-02-22 06:04

reporter   ~0028275

Since there is no real feedback on this issue, i found a way around.
I add the configuration option to config_inc.php and read that setting like :
config_get_global( 'tasks_show_menu' );
Now there is no error message.
This is NOT a preferred solution.

To me it seems that we need a special routine that can read such plugin settings without authenticating the users.
Perhaps something to include in 1.3?



2011-03-25 09:50

reporter   ~0028481

Any feedback on this issue?



2024-05-23 06:00

developer   ~0068945

Hi @cas I just noticed today this old issue that never got any response, sorry about that.

I'm not sure that the problem still exists - as far as I can tell, calling plugin_config_get() when initializing a plugin does not result in an error (tested with 2.26.2). Please confirm.

As a side note, I am not sure why you are using plugin_event_hook() and where you call it. This is normally an internal plugin API function, there should be no need for a plugin to call it directly. The normal way for a plugin to hook events, is to overload the MantisPlugin::hooks() methods, that just returns an array of events to hook, with event name as key and callback function as value, e.g.

function hooks() {
    return array(
        'EVENT_MENU_MAIN' => 'menu_main',


2024-05-23 09:46

reporter   ~0068949

Issue can be closed, already solved this in the correct way.