Search code examples
phpfunctionmantis

Error: function user_pref_get_language() On Mantis


I have set up a new installation of Mantis BT on windows server 2008. When I try to install the email reporting plugin I am getting this error Fatal error: Uncaught Error: Call to undefined function user_pref_get_language() in E:\xampp\htdocs\mantis\core\lang_api.php:107.

The fucntion is: function lang_get_default() { global $g_active_language;

$t_pref_file = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'user_pref_api.php';
    require_once($t_pref_file);

$t_lang = false;

# Confirm that the user's language can be determined
if( function_exists( 'auth_is_user_authenticated' ) && auth_is_user_authenticated() ) {
    $t_lang = user_pref_get_language( auth_get_current_user_id() );   ****Line 107****

}

# Otherwise fall back to default
if( !$t_lang ) {
    $t_lang = config_get_global( 'default_language' );
}

if( $t_lang == 'auto' ) {
    $t_lang = lang_map_auto();
}

# Remember the language
$g_active_language = $t_lang;

return $t_lang;

}

Thank you for your help.


Solution

  • you have this function "user_pref_get_language()" in file user_pref_api.php in core ?

    function user_pref_get_language( $p_user_id, $p_project_id = ALL_PROJECTS )     {
        $t_prefs = user_pref_get( $p_user_id, $p_project_id );
        $t_lang = $t_prefs->language;
        if( !lang_language_exists( $t_lang ) ) {
            $t_lang = null;
        }
        return $t_lang;
        }