Documentation

UserUtil

User Extended by Shawn Clake Class UserUtil User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

Table of Contents

castToRainLabUser()  : User
Casts the Rainlab.User model to Clake.UserExtended
castToUserExtendedUser()  : UserExtended
Casts the Clake.UserExtended model to Rainlab.User Faster than converting, but less thorough
convertToRainlabUser()  : mixed
Takes a UserExtended.User model and generates a Rainlab.User model instead
convertToUserExtendedUser()  : mixed
Convert a RainLab.User object to a UserExtended User object Slower than casting, but more thorough
getLoggedInUser()  : null
Returns the logged in user. Typically used across all of my plugins
getLoggedInUserExtendedUser()  : mixed
Gets the logged in user object and converts it to an UserExtended user object before returning it
getLoggedInUsersTimezone()  : string|null
Returns a Timezone model for the current logged in user
getRainlabUser()  : mixed
Get the rainlab user instance.
getUser()  : mixed
Get the first user with the search criteria
getUserForUserId()  : mixed|null
Returns the UserExtended object for the user ID passed in. If the user ID passed in is null, gets logged in user.
getUsers()  : mixed
Get all users with the search criteria
getUsersIdElseLoggedInUsersId()  : null
Returns the passed in $userid unless its null, then it returns the logged in users id. If both are null, it returns null
getUserTimezone()  : null|string
Get a users current timezone.
idIsLoggedIn()  : bool
Returns the user id of the logged in user
redirectIfNotLoggedIn()  : mixed
Redirect a user if they aren't logged in.
searchUsers()  : UserExtended
Search for a user via the phrase

Methods

castToUserExtendedUser()

Casts the Clake.UserExtended model to Rainlab.User Faster than converting, but less thorough

public static castToUserExtendedUser(User $user) : UserExtended
Parameters
$user : User
Return values
UserExtended

convertToRainlabUser()

Takes a UserExtended.User model and generates a Rainlab.User model instead

public static convertToRainlabUser( $user) : mixed
Parameters
$user :
Return values
mixed

convertToUserExtendedUser()

Convert a RainLab.User object to a UserExtended User object Slower than casting, but more thorough

public static convertToUserExtendedUser( $user) : mixed
Parameters
$user :
Return values
mixed

getLoggedInUser()

Returns the logged in user. Typically used across all of my plugins

public static getLoggedInUser() : null
Return values
null

getLoggedInUserExtendedUser()

Gets the logged in user object and converts it to an UserExtended user object before returning it

public static getLoggedInUserExtendedUser() : mixed
Return values
mixed

getLoggedInUsersTimezone()

Returns a Timezone model for the current logged in user

public static getLoggedInUsersTimezone() : string|null
Return values
string|null

getRainlabUser()

Get the rainlab user instance.

public static getRainlabUser( $value[, string $property = "id" ]) : mixed

Required for backward compatibility with relations like 'avatar'

Parameters
$value :
$property : string = "id"
Return values
mixed

getUser()

Get the first user with the search criteria

public static getUser( $value[, string $property = "id" ]) : mixed
Parameters
$value :
$property : string = "id"
Return values
mixed

getUserForUserId()

Returns the UserExtended object for the user ID passed in. If the user ID passed in is null, gets logged in user.

public static getUserForUserId([null $userId = null ]) : mixed|null
Parameters
$userId : null = null
Return values
mixed|null

getUsers()

Get all users with the search criteria

public static getUsers( $value[, string $property = "name" ]) : mixed
Parameters
$value :
$property : string = "name"
Return values
mixed

getUsersIdElseLoggedInUsersId()

Returns the passed in $userid unless its null, then it returns the logged in users id. If both are null, it returns null

public static getUsersIdElseLoggedInUsersId([null $userId = null ]) : null
Parameters
$userId : null = null
Return values
null

getUserTimezone()

Get a users current timezone.

public static getUserTimezone( $value[, string $property = "id" ]) : null|string
Parameters
$value :
$property : string = "id"
Return values
null|string

idIsLoggedIn()

Returns the user id of the logged in user

public static idIsLoggedIn( $userId) : bool
Parameters
$userId :
Return values
bool

redirectIfNotLoggedIn()

Redirect a user if they aren't logged in.

public static redirectIfNotLoggedIn([string $url = '/' ]) : mixed

DO NOT USE. CURRENTLY BROKEN.

Parameters
$url : string = '/'
Return values
mixed

Search results