public function getUserData($key, $id = 0)
    {
        // Current User id
        if (!$id) {
            if (defined('USER_ID')) {
                $id = USER_ID;
            } else {
                return NULL;
            }
        } else {
            $id = abs((int)$id);
        }

        // Check or init cache
        if (!isset(self::$cached_user_data[$id])) {
            $user = AdminUserRepository::findOneEntityById($id);
            if (!$user) {
                return NULL;
            }
            self::$cached_user_data[$id] = $user->getAsArray();

            // Unset critical data
            unset(self::$cached_user_data[$id]['password']);
        }

        return isset(self::$cached_user_data[$id][$key]) ? self::$cached_user_data[$id][$key] : NULL;
    }
public function getUserData($key, $id = 0)
    {
        // Current User id
        if (!$id) {
            if (defined('USER_ID')) {
                $id = USER_ID;
            } else {
                return NULL;
            }
        } else {
            $id = abs((int)$id);
        }

        // Check or init cache
        if (!isset(self::$cached_user_data[$id])) {
            $user = AdminUserRepository::findOneEntityById($id);
            if (!$user) {
                return NULL;
            }
            self::$cached_user_data[$id] = $user->getAsArray();

            // Unset critical data
            unset(self::$cached_user_data[$id]['password']);
        }

        return isset(self::$cached_user_data[$id][$key]) ? self::$cached_user_data[$id][$key] : NULL;
    }
public function getUserData ( $ key , $ id = 0 ) { // Current User id if ( ! $ id ) { if ( defined ( 'USER_ID' ) ) { $ id = USER_ID ; } else { return NULL ; } } else { $ id = abs ( ( int ) $ id ) ; } // Check or init cache if ( ! isset ( self :: $ cached_user_data [ $ id ] ) ) { $ user = AdminUserRepository :: findOneEntityById ( $ id ) ; if ( ! $ user ) { return NULL ; } self :: $ cached_user_data [ $ id ] = $ user -> getAsArray ( ) ; // Unset critical data unset ( self :: $ cached_user_data [ $ id ] [ 'password' ] ) ; } return isset ( self :: $ cached_user_data [ $ id ] [ $ key ] ) ? self :: $ cached_user_data [ $ id ] [ $ key ] : NULL ; }
Get User's data by key

@param string $key key to get value
@param int    $id  user id to get value from

@return string
Get User s data by key