PHP Класс ElggUser, Elgg

Representation of a "user" in the system.
Наследование: extends ElggEntity, implements Friendable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( stdClass $row = null ) Construct a new user entity
__set ( $name, $value )
addFriend ( integer $friend_guid, boolean $create_river_item = false ) : boolean Adds a user as a friend
ban ( string $reason = "" ) : boolean Ban this user.
canComment ( integer $user_guid, boolean $default = null ) : boolean Can a user comment on this user?
getDisplayName ( )
getExternalAttributes ( ) : array Get default values for attributes stored in a separate table
getFriends ( array $options = [] )
getFriendsObjects ( array $options = [] )
getFriendsOf ( array $options = [] )
getGroups ( array $options = [] ) : array | false Gets the user's groups
getNotificationSettings ( ) : array Returns users's notification settings [ 'email' => true, // enabled 'ajax' => false, // disabled ]
getObjects ( array $options = [] )
getOwnerGUID ( ) : integer Get a user's owner GUID
isAdmin ( ) : boolean Is this user admin?
isBanned ( ) : boolean Is this user banned or not?
isFriend ( ) : boolean Determines whether or not this user is a friend of the currently logged in user
isFriendOf ( integer $user_guid ) : boolean Determines whether or not this user is another user's friend
isFriendsWith ( integer $user_guid ) : boolean Determines whether this user is friends with another user
makeAdmin ( ) : boolean Make the user an admin
removeAdmin ( ) : boolean Remove the admin flag for user
removeFriend ( integer $friend_guid ) : boolean Removes a user as a friend
setDisplayName ( $displayName )
setNotificationSetting ( string $method, boolean $enabled = true ) : boolean Enable or disable a notification delivery method
setPassword ( string $password ) : void Set the necessary attribute to store a hash of the user's password.
unban ( ) : boolean Unban this user.

Защищенные методы

Метод Описание
create ( )
initializeAttributes ( ) : void Initialize the attributes array.
load ( mixed $guid ) : boolean Load the \ElggUser data from the database
prepareObject ( $object )
update ( )

Описание методов

__construct() публичный Метод

Plugin developers should only use the constructor to create a new entity. To retrieve entities, use get_entity() and the elgg_get_entities* functions.
public __construct ( stdClass $row = null )
$row stdClass Database row result. Default is null to create a new user.

__set() публичный Метод

public __set ( $name, $value )

addFriend() публичный Метод

Adds a user as a friend
public addFriend ( integer $friend_guid, boolean $create_river_item = false ) : boolean
$friend_guid integer The GUID of the user to add
$create_river_item boolean Create the river item announcing this friendship
Результат boolean

ban() публичный Метод

Ban this user.
public ban ( string $reason = "" ) : boolean
$reason string Optional reason
Результат boolean

canComment() публичный Метод

Can a user comment on this user?
См. также: ElggEntity::canComment()
С версии: 1.8.0
public canComment ( integer $user_guid, boolean $default = null ) : boolean
$user_guid integer User guid (default is logged in user)
$default boolean Default permission
Результат boolean

create() защищенный Метод

protected create ( )

getDisplayName() публичный Метод

public getDisplayName ( )

getExternalAttributes() закрытый публичный статический Метод

Get default values for attributes stored in a separate table
См. также: Elgg\Database\EntityTable::getEntities
final public static getExternalAttributes ( ) : array
Результат array

getFriends() публичный Метод

public getFriends ( array $options = [] )
$options array

getFriendsObjects() публичный Метод

public getFriendsObjects ( array $options = [] )
$options array

getFriendsOf() публичный Метод

public getFriendsOf ( array $options = [] )
$options array

getGroups() публичный Метод

Gets the user's groups
public getGroups ( array $options = [] ) : array | false
$options array Options array.
Результат array | false Array of \ElggGroup, or false, depending on success

getNotificationSettings() публичный Метод

Returns users's notification settings [ 'email' => true, // enabled 'ajax' => false, // disabled ]
public getNotificationSettings ( ) : array
Результат array

getObjects() публичный Метод

public getObjects ( array $options = [] )
$options array

getOwnerGUID() публичный Метод

Returns it's own GUID if the user is not owned.
public getOwnerGUID ( ) : integer
Результат integer

initializeAttributes() защищенный Метод

This is vital to distinguish between metadata and base attributes.
protected initializeAttributes ( ) : void
Результат void

isAdmin() публичный Метод

Is this user admin?
public isAdmin ( ) : boolean
Результат boolean

isBanned() публичный Метод

Is this user banned or not?
public isBanned ( ) : boolean
Результат boolean

isFriend() публичный Метод

Determines whether or not this user is a friend of the currently logged in user
public isFriend ( ) : boolean
Результат boolean

isFriendOf() публичный Метод

Determines whether or not this user is another user's friend
public isFriendOf ( integer $user_guid ) : boolean
$user_guid integer The GUID of the user to check against
Результат boolean

isFriendsWith() публичный Метод

Determines whether this user is friends with another user
public isFriendsWith ( integer $user_guid ) : boolean
$user_guid integer The GUID of the user to check against
Результат boolean

load() защищенный Метод

Load the \ElggUser data from the database
protected load ( mixed $guid ) : boolean
$guid mixed \ElggUser GUID or \stdClass database row from entity table
Результат boolean

makeAdmin() публичный Метод

Make the user an admin
public makeAdmin ( ) : boolean
Результат boolean

prepareObject() защищенный Метод

protected prepareObject ( $object )

removeAdmin() публичный Метод

Remove the admin flag for user
public removeAdmin ( ) : boolean
Результат boolean

removeFriend() публичный Метод

Removes a user as a friend
public removeFriend ( integer $friend_guid ) : boolean
$friend_guid integer The GUID of the user to remove
Результат boolean

setDisplayName() публичный Метод

public setDisplayName ( $displayName )

setNotificationSetting() публичный Метод

Enable or disable a notification delivery method
public setNotificationSetting ( string $method, boolean $enabled = true ) : boolean
$method string Method name
$enabled boolean Enabled or disabled
Результат boolean

setPassword() публичный Метод

Set the necessary attribute to store a hash of the user's password.
С версии: 1.10.0
public setPassword ( string $password ) : void
$password string The password to be hashed
Результат void

unban() публичный Метод

Unban this user.
public unban ( ) : boolean
Результат boolean

update() защищенный Метод

protected update ( )