Joomla - call function model within the model

In a public function of my model I call

$user_type=$this->get_user_type();

In the same model I have

private function get_user_type()
{
    $user_type='asd';
    $asd_groups = (int)$config->get('asd_groups');
    $ver_groups = (int)$config->get('ver_groups');

    jimport( 'joomla.user.helper' );
    $user_groups=JUserHelper::getUserGroups($user->id);
    if(in_array($asd_groups,$user_groups)){
        $user_type='asd';
    }

    if(in_array($ver_groups,$user_groups)){
        $user_type='ver';
    }

    return $user_type;
}

The site give me a white page, if I comment the calling line "$this->get_user_type();" then it works... I really don't understand what is wrong here.

Answers


There is not enough information or code here to help you… for example where is $config coming from and what is it? What version of Joomla is this on?

If $config is not defined as a global then that may be the source of the problem depending on your PHP setup.

Things you can do to help yourself find the problem, in Joomla's Global Configuration.

  1. Set Error Messages to "Development" in Joomla (you are using a development site and not a live website right?)
  2. Turn on Joomla's DEBUG mode

Then update your question with details of error messages, Joomla version and where this code is running (you say your model) and where $config is coming from.


Need Your Help

Dead Simple Java IO & Enum Question

java enums io

I know there is something dead simple I'm missing, but the following code won't write the text using println:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.