Merge branch 'maint/7.0'
[ninja.git] / application / helpers / user.php
blob8e8544ea631a6b7aa0da34771d967a942b39f2af
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Help class for user session data
4 */
5 class user
7 /**
8 * Fetch session data for certain variable
10 * @param $var string: Variable name to return value for
11 * @return Value from session on success. false if not found
13 public static function session($var = false)
15 $return = false;
16 return !empty(Auth::instance()->get_user()->$var) ? Auth::instance()->get_user()->$var : false;
17 $user_data = Session::instance()->get('user_data', false);
18 if (is_object($user_data) && isset($user_data->$var)) {
19 $return = $user_data->$var;
21 if (!$return) {
22 $return = Session::instance()->get($var, false);
24 return $return;