If it helps any, here is what I have in the controller:
public function action_index()
{
$view = View::forge('news/index');
$news_array = Model_News::get_news(date('m'));
if (parent::$userid == true) {
if(Auth::member(100, parent::$userid)) {
//user is admin
$admin = true;
} else {
//user is not admin
$admin = false;
}
} else {
//user is not logged in nor admin
$admin = false;
}
$view->set('news_array', $news_array, false);
$view->set('admin', $admin, false);
$this->template->content = $view;
}
Everything works fine UNTIL I do the Auth::member() function. If I delete that and just put whatever I want in the $admin variable, it keeps me logged in.
The default instance is accessed via Auth::instance(). All static method calls also use the default instance, so as long as you don't create a second instance manually, there won't be one that could be used.
The issue is that the prototype of member() is: member($group, $driver = null, $user = null)
which means you're passing the userid (why parent:: btw? that's a really odd way to access a property) as the driver, you should include either the driver name, or null.
p.s. to check membership of the current user, you only have to pass the group number.
Ok... anytime I use Auth::ANY FUNCTION HERE.. it erases my set sessions and logs me out. Doesn't matter which function I use. ANY of them logs me out..
So I'm not even sure on how to do anything.
And I have a protected static variable in the Base Controller called $userid getting the user on every page load so I dont have to do it in every single controller because it was logging me out when I did that as well.
Are you sure it's this, and not the fact that you have a cookie issue?
Have you checked if your session cookies are ok? If your time configuration is not ok (server timezone === php.ini date.timezone === fuel config timezone), GMT time calculations fail, and you will lose your session at every page request.