Welcome Guest, Not a member yet? Register   Sign In
Community Auth verify_min_level logging users out?
#4

(This post was last modified: 05-23-2016, 07:51 AM by skunkbad.)

OK, now I see the problem, and this is something others have done too. You should only be using one of the auth methods per request, and in your code you are using two. By auth methods, I mean:
  • require_min_level()
  • require_group()
  • require_role()
  • optional_login()
  • is_logged_in()
  • verify_min_level()
  • verify_role()
The reason why you only should use one method per request is that after that one method call you have all the auth variables, and so you use them instead. Doing more calls to auth methods just requires extra database queries you don't need.

For instance, in controllers if you want to know the user level (now called auth level):


Code:
if( $this->auth_level >= 10 )


In a view, you would use:


Code:
if( isset( $auth_level ) && $auth_level >= 10 )


and if you are in any place where you don't have access to those, like a model:


Code:
if( config_item('auth_level') >= 10 )
Reply


Messages In This Thread
RE: Community Auth verify_min_level logging users out? - by skunkbad - 05-23-2016, 07:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB