Visitor Class

package XenForo_Core

 Methods

Magic method for array access

__get($name) 

Parameters

$name

Returns true if the visitor can edit his/her signature.

canEditSignature() : boolean

Returns

boolean

canFollow()

canFollow() 

Returns true if visitor can run searches.

canSearch() : boolean

Does not cover find new or user content searches.

Returns

boolean

canStartConversations()

canStartConversations() 

Determines if the visitor can update his/hew status.

canUpdateStatus() : boolean

Returns

boolean

Returns true if visitor can upload/change their avatar.

canUploadAvatar() : boolean

Returns

boolean

OO approach to getting a value from the visitor.

get(string $name) : mixed

Good if you want a single value in one line.

Parameters

$name

string

Returns

mixedFalse if the value can't be found

Get all cached node permissions for the visitor.

getAllNodePermissions() : array

Not all nodes may be present.

Returns

arrayFormat: [node id] => permissions

Gets the browsing user's info.

getInstance() : \XenForo_Visitor
Static

Gets the user's language.

getLanguage() : array

Returns

array

Gets the visitor's permissions for a specific node.

getNodePermissions(integer $nodeId) : array

Permissions will be fetched if necessary.

Parameters

$nodeId

integer

Returns

array

Returns the permission combination ID of the current visiting user

getPermissionCombinationId() : integer
Static

Returns

integerpermission combination ID

Gets all global permissions for the visitor.

getPermissions() : array

Returns

arrayFormat: [group][permission] => value

Returns the user ID of the current visiting user

getUserId() : integer
Static

Returns

integerUser ID

Determines if the current user has the specified admin permission.

hasAdminPermission(string $permissionId) : boolean

Parameters

$permissionId

string

Returns

boolean

Determines if we have a visitor instance setup.

hasInstance() : boolean
Static

Returns

boolean

Determines if the visitor has the specified permission on a specific node.

hasNodePermission(integer $nodeId, string $permission) : boolean

Parameters

$nodeId

integer

$permission

string

Returns

boolean

Returns true if there are node permissions cached for the specified node.

hasNodePermissionsCached(integer $nodeId) : boolean

Parameters

$nodeId

integer

Returns

boolean

Determines if the visitor has a specific permission.

hasPermission(string $group, string $permission) : boolean | int

Parameters

$group

string

Permission group

$permission

string

Returns

booleanint

Checks to verify that the visitor is browsing with a particular user agent

isBrowsingWith(string $browser) : boolean
Static

Parameters

$browser

string

Returns

boolean

Returns whether or not the specified user is being followed by the visitor

isFollowing(integer $userId) : boolean

Parameters

$userId

integer

Returns

boolean

Returns whether or not the specified user is being ignored by the visitor

isIgnoring(integer $userId) : boolean

Parameters

$userId

integer

Returns

boolean

Determines if the visitor is a member of the specified user group

isMemberOf(integer $userGroupId, boolean $includeSecondaryGroups) : boolean

Parameters

$userGroupId

integer

$includeSecondaryGroups

boolean

Returns

boolean

Determines if current user is a super admin.

isSuperAdmin() : boolean

Returns

boolean

For ArrayAccess.

offsetExists(string $offset) 

Parameters

$offset

string

For ArrayAccess.

offsetGet(string $offset) 

Parameters

$offset

string

For ArrayAccess.

offsetSet(string $offset, mixed $value) 

Parameters

$offset

string

$value

mixed

For ArrayAccess.

offsetUnset(string $offset) 

Parameters

$offset

string

Set the visitor's permissions for a particular node.

setNodePermissions(integer $nodeId, array | string $permissions) 

Useful caching.

Parameters

$nodeId

integer

$permissions

arraystring

Permissions (may be serialized)

setVisitorLanguage()

setVisitorLanguage($languageId) 

Parameters

$languageId

Setup the visitor singleton.

setup(integer $userId, array $options) : \XenForo_Visitor
Static

Parameters

$userId

integer

User ID to setup as

$options

array

Returns

Returns true if the visitor should be shown a CAPTCHA.

showCaptcha() : boolean

Returns

boolean

Gets the user info in array format (for areas that require actual arrays).

toArray() : array

Returns

array

Protected constructor.

__construct() 

Use getInstance() instead.

 Properties

 

$_adminPermissions : array | null

Note that this may not be populated until necessary.

 

$_browsers : array
 

$_instance : \XenForo_Visitor
 

$_isSuperAdmin : boolean | null
 

$_language : array
 

$_nodePermissions : array
 

$_user : array