class vB_Api_User extends vB_Api

vB_Api_User

Constants

USERINFO_AVATAR

USERINFO_PROFILEPIC

USERINFO_ADMIN

USERINFO_SIGNPIC

USERINFO_ISFRIEND

DEFAULT_AVATAR_PATH_REGULAR

DEFAULT_AVATAR_PATH_THUMB

DEFAULT_AVATAR_PATH_LARGE

Properties

protected $disableWhiteList
protected $disableFalseReturnOnly
protected $users
protected $groupInTopic
protected $moderatorsOf
protected $membersOf
protected $permissionContext
protected $referrals
protected $avatarsCache
protected $avatarUserCache
protected $usertitleCache
protected $privacyOptions
protected $library
protected array $pendingAvatarUserids An array of userids to batch-fetch avatar information for.
protected array $loadedAvatarUserids Array of userids that have already been used to batch-fetch avatar information

Methods

__construct()

Constructor

array
fetchProfileInfo(int $userid = false)

This gets the information needed for a user's profile. Only public information unless this is an admin or the user.

setCurrentUserFlags($userInfo)

Set current user flags to display or not certain user items.

fetchUserSettings($userid = false)

Fetches the needed info for user settings

array
fetchUserinfo(integer $userid = false, array $option = array(), integer $languageid = false, boolean $nocache = false)

Fetches an array containing info for the specified user, or false if user is not found

array
fetchCurrentUserinfo()

Fetches an array containing info for the current user

string
fetchUserName(integer $userid)

Fetches the username for a userid, or false if user is not found

string
fetchMusername(array $user, string $displaygroupfield = 'displaygroupid', string $usernamefield = 'username')

fetches the proper username markup and title

array
fetchByUsername(string $username, array $option = array())

Fetch user by its username

array
fetchByEmail(string $email, array $option = array())

Fetch user by its email

array
memberList(array $criteria = array())

Fetch a list of user based on the provided criteria

bool
find(array $user, array $profile, string $orderby, string $direction, integer $limitstart = 0, integer $limitnumber = 25)

Find user

array
getGroupInTopic(int $userid = false, int $nodeid = false, boolean $forceReload = false)

This returns a user's additional permissions from the groupintopic table

array
getModeratorsOf(int $userid = false)

Returns a list of channels where this user is moderator

array
getMembersOf(int $userid = false)

Returns a list of channels where this user is moderator

array
getCanCreate(int $nodeid)

This is a wrapper for userContext getCanCreate- it returns the content types a user can create

computeMembersOf(int $userid)

Analyzes what groups this user belongs to in specific channels. Stores in member variables

bool
setGroupInTopic(int $userid, array|int $nodeids, int $usergroupid)

This grants a user additional permissions in a specific channel, by adding to the groupintopic table

bool
unsetGroupInTopic($userid, $nodeids, $usergroupid)

This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table

clearChannelPerms(int $userid)

This method clears remembered channel permission

registerNeedAvatarForUsers(array $userids)

Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.

array
fetchAvatar($userid, $thumb = false, $userinfo = array())

Fetches the URL for a User's Avatar

array
fetchAvatars(array $userids = array(), boolean $thumb = false, array $userinfo = array())

Fetch the Avatars for a userid array

array
fetchProfileFieldsForRegistration(array $userinfo = array())

Fetches the Profile Fields that needs to be displayed in Registration From

void
_processProfileFields(array $profilefields, array $currentvalues)

Process Profile Fields for templates

delete(integer $userid, bool $transfer_groups = true)

Delete a user

integer
saveEmailPassword(array $extra)

Shortcut to saving only email and password if user only has permission to modify password and email

integer
save(integer $userid, string $password, array $user, array $options, array $adminoptions, array $userfield, array $notificationOptions = array(), array $hvinput = array(), array $extra = array())

Insert or Update an user

sendActivateEmail($email)

No description

string
activateUserByUsername(string $username, string $activateid)

Activate an user with an activate ID and Username

string
activateUser(int $userid, string $activateid)

Activate an user with an activate ID

deleteActivation($userid, $activateid)

No description

killActivation($userid, $activateid)

No description

string
saveSignature(string $signature, array $filedataids = array())

Verifies and saves a signature for current logged in user. Returns the signature.

array
fetchAwaitingModerate()

Fetch a list of users who are awaiting moderate or Coppa

bool
moderate(array $validate, bool $send_validated, bool $send_deleted)

Moderate users

array
fetchPruneUsers($usergroupid, $includeSecondary, $daysprune, $minposts, $joindate, $order)

Return a list of users for pruning or moving

prune(array $userids, string $dowhat, integer $movegroup = 0)

Do prune/move users (step 1)

integer
pruneUpdateposts(integer $startat)

Do prune/move users (step 2). Userids to be updated are stored in adminutil table.

array
changeHistory(integer $userid)

Return user change history

merge(integer $sourceuserid, integer $destuserid)

Merge two users

updateAvatar($userid, $avatarid, $data = array(), $cropped = false)

Update avatar

updateSigPic(integer $userid, bool $delete, array $data = array())

Update profile picture

array
getPrivacyConsentRequired()

Return if the privacy consent is required for the current session

array
searchIP(string $userid, integer $depth = 1)

Search IP Addresses

array
searchUsersByIP(string $ipaddress, integer $depth)

Search IP Addresses

_searchRegisterIP($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_register_table()

_searchUserIP($userid, $previpaddress, $depth = 2)

Rewrite function construct_user_ip_table()

_searchIPUsage($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_usage_table()

array
fetchReferrers(array $startdate, array $enddate)

Return a report of referrers

bool
isBanned(integer $userid)

Check whether a user is banned.

bool
isBannedEmail(string $email)

Check whether an email address is banned from the forums

resetMfaSecret(string $password, string $mfa_authcode = null)

Reset the current user's MFA secret

enableMfa(string $password, string $mfa_authcode)

Enable the user's current MFA record after verify password and authcode

array
setMfaEnabled(int $userid, bool $enabled)

Sets the users MFA record to enabled or disabled

isMfaEnabled(int $userid)

Gets whether or not the user has an enabled MFA record

array
needMFA(string $logintype)

Indicates if the current user needs to provide an MFA code for login.

array
login($username, $password = null, $md5password = null, $md5password_utf = null, $logintype = null) deprecated

Login a user

array
login2(string $username, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user

array
loginSpecificUser(int $userid, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user for which we have the userid

array.
loginExternal($provider, $info, $userid = null)

Log in via a third party provider.

bool
logout($logouthash = null)

Logout user

bool
emailPassword(integer $userid, string $email, array $hvinput = array())

Email user a password reset email

string[]
setNewPassword(integer $userid, string $activationid, string $newpassword)

Set a new password for a user. Used by "forgot password" function.

processPasswordResetLockout($userinfo, $useractivation, $activationid)

No description

int
needsCoppa(array $dateInfo)

This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call

bool
useCoppa()

This checks whether the site uses COPPA review

bool
checkUsername(username $candidate)

This checks whether the a username is available and valid

currentUserHasAdminPermission($adminPermission)

No description

array
getAutocomplete(string $searchStr, string $orderby = 'username', string $direction = 'ASC', int $limitstart = 0, int $limitnumber = 15)

Returns suggested usernames for the username autocomplete popup menu.

setDefaultAvatar(int $avatarid)

This sets a user to use one of the default avatars.

fetchUserSearchCondition($user, $profile, $prefix = 'user')

Convert the search array to the assertor conditions.

array
fetchSignature(int $userid)

Get the profile information so the presentation can render it

getProfileFieldConditions($profilefield, $profile)

No description

array
fetchBirthdays()

Fetch today's birthdays

array
fetchUsernames(array $userIds, bool $profileUrl = true)

Returns an array with the usernames for the user ids and optionally the profileUrl for the user

updateIgnorelist(int $userid, String[] $userList)

Updates the user ignore list

String
updateStatus(int $userid = false, String $status)

Updates the user status

banUsers(array $userids, int $banusergroupid, string $period, string $reason = '')

Ban users

boolean|int
hasPermissions(string $group, string $permission, boolean $nodeid = false)

Returns global permission value or specific value for a nodeid for current user.

integer
canRemovePost(integer $nodeid)

Checks the various options as to whether the current user can physically remove a post

boolean|int
havePermissions(string $group, string $permission, array $nodeIds = array())

Returns permission values of a group of nodes for current user.

inviteMembers($userIds, $userNames, $nodeId, $requestType)

Invites members to a given node channel passing either an array of userids or usernames.

bool
generateMailingList($user, $profile, $options = array())

Generates users mailing list for the given criteria.

array
getUsersFromCriteria($user, $profile, $options = array())

Fetch users and info from a given user criteria Used for admincp - verticalresponse.

array
fetchUsersPms($options = array())

Fetch private messages statistics from all the users.

fetchAdminUser()

This implements vB_PermissionContext::getAdminUser().

array
fetchUserProfileFields()

This gets the current user profile fields from the database.

string
getUsertitleFromPosts(int $posts)

Get the user title regarding the given posts.

array
getPrivacyOptions()

Mostly a getter for user privacy options.

array
getGitCanStart(int $parentNodeId)

This likes the channels below a parent node where a user can create starters based on groupintopic

1
canCreateBlogEntry(int $nodeid = 0)

Tells whether the current user can create a blog entry. That can be their own permissions or GIT.

integer
fetchTimeOffset($adjustForServer = false, $userid = false, $ignoreDST = false)

Adjust GMT time back to user's time Use "gm" versions of date/time functions with this offset, not ones that rely on current server's system timezone.

integer
vBMktime(array $dateInfo)

translate a year/month/day/hour/minute to a Unix timestamp.

userTimeStrToUnixtimestamp($strTime, $userid = false, $ignoreDST = true)

No description

unixtimestampToUserDateString($timestamp, $userid = false, $format = "Y-m-d H:i:s", $ignoreDST = true)

No description

updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

setPrivacyConsent(int $userid, array $data = array())

Set privacy consent and eu status for user

array
getPersonalData($userid = 0)

Returns a report on "personal information" for a user

array
verifyFlashMessageSignature(string $phrase, string $timestamp, string $hash)

Verifies that a flash message passed through the URL is signed and valid

array
saveEditorState(string $action, int $value)

Saves the content entry UI editor "state" where state is the show/hide state of the following 3 content entry UIs: ckeditor toolbar, attachements panel, and smilies panel.

Details

at line 89
protected __construct()

Constructor

at line 101
array fetchProfileInfo(int $userid = false)

This gets the information needed for a user's profile. Only public information unless this is an admin or the user.

Parameters

int $userid -- uses the current logged in user if not given. Error if the user is a guest.

Return Value

array -- the profile information.

at line 313
protected setCurrentUserFlags($userInfo)

Set current user flags to display or not certain user items.

Parameters

$userInfo

at line 351
fetchUserSettings($userid = false)

Fetches the needed info for user settings

Parameters

$userid

at line 739
array fetchUserinfo(integer $userid = false, array $option = array(), integer $languageid = false, boolean $nocache = false)

Fetches an array containing info for the specified user, or false if user is not found

Values for Option parameter: avatar - Get avatar profilepic - Join the customprofilpic table to get the userid just to check if we have a picture admin - Join the administrator table to get various admin options signpic - Join the sigpic table to get the userid just to check if we have a picture isfriend - Is the logged in User a friend of this person? Therefore: array('avatar', 'location') means 'Get avatar' and 'Process online location'

Parameters

integer $userid User ID
array $option Fetch Option (see description)
integer $languageid Language ID. If set to 0, it will use user-set languageid (if exists) or default languageid
boolean $nocache If true, the method won't use user cache but fetch information from DB.

Return Value

array The information for the requested user

at line 778
array fetchCurrentUserinfo()

Fetches an array containing info for the current user

Return Value

array The information for the requested user. Userinfo record plus language information

at line 818
string fetchUserName(integer $userid)

Fetches the username for a userid, or false if user is not found

Parameters

integer $userid User ID

Return Value

string

at line 836
string fetchMusername(array $user, string $displaygroupfield = 'displaygroupid', string $usernamefield = 'username')

fetches the proper username markup and title

Parameters

array $user User info array
string $displaygroupfield Name of the field representing displaygroupid in the User info array
string $usernamefield Name of the field representing username in the User info array

Return Value

string Username with markup and title

at line 850
array fetchByUsername(string $username, array $option = array())

Fetch user by its username

Parameters

string $username Username
array $option Fetch Option (see description of fetchUserinfo())

Return Value

array The information for the requested user

at line 890
array fetchByEmail(string $email, array $option = array())

Fetch user by its email

Parameters

string $email Email
array $option Fetch Option (see description of fetchUserinfo())

Return Value

array The information for the requested user

at line 920
array memberList(array $criteria = array())

Fetch a list of user based on the provided criteria

Parameters

array $criteria values for criteria: int $pagenumber the page to start from int $perpage number of members to display on a page string $sortfield the foeld to sort by string $sortorder the sort order (asc/desc) string $startswith the first letter(s) the username should match

Return Value

array members - the list of members that match the criteria pagingInfo - pagination information

at line 996
bool find(array $user, array $profile, string $orderby, string $direction, integer $limitstart = 0, integer $limitnumber = 25)

Find user

Parameters

array $user An array of common conditions for user search
array $profile An array of user profile field conditions for user search
string $orderby Order by
string $direction Order direction
integer $limitstart Limit start
integer $limitnumber Limit number

Return Value

bool |array False if no user found. Otherwise it returns users array as result. The array also contains a field that stores total found user count.

at line 1045
array getGroupInTopic(int $userid = false, int $nodeid = false, boolean $forceReload = false)

This returns a user's additional permissions from the groupintopic table

Parameters

int $userid
int $nodeid -- optional
boolean $forceReload -- optional defaults to false

Return Value

array -- Array of array('nodeid' => nodeid, 'groupid' => groupid);

at line 1080
array getModeratorsOf(int $userid = false)

Returns a list of channels where this user is moderator

Parameters

int $userid

Return Value

array -- nodeids

at line 1121
array getMembersOf(int $userid = false)

Returns a list of channels where this user is moderator

Parameters

int $userid

Return Value

array -- nodeids

at line 1161
array getCanCreate(int $nodeid)

This is a wrapper for userContext getCanCreate- it returns the content types a user can create

Parameters

int $nodeid

Return Value

array -- types the user can create in that node

at line 1175
protected computeMembersOf(int $userid)

Analyzes what groups this user belongs to in specific channels. Stores in member variables

Parameters

int $userid

at line 1246
bool setGroupInTopic(int $userid, array|int $nodeids, int $usergroupid)

This grants a user additional permissions in a specific channel, by adding to the groupintopic table

Parameters

int $userid
array|int $nodeids
int $usergroupid

Return Value

bool

at line 1288
bool unsetGroupInTopic($userid, $nodeids, $usergroupid)

This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table

Parameters

$userid
$nodeids
$usergroupid

Return Value

bool

at line 1367
clearChannelPerms(int $userid)

This method clears remembered channel permission

Parameters

int $userid The userid to be cleared

at line 1384
registerNeedAvatarForUsers(array $userids)

Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.

Parameters

array $userids Array if integer user IDs for the users whose avatars we will be fetching later.

at line 1402
array fetchAvatar($userid, $thumb = false, $userinfo = array())

Fetches the URL for a User's Avatar

Parameters

$userid
$thumb
$userinfo

Return Value

array Information regarding the avatar

at line 1447
array fetchAvatars(array $userids = array(), boolean $thumb = false, array $userinfo = array())

Fetch the Avatars for a userid array

Parameters

array $userids The User IDs array
boolean $thumb Whether to get the Thumbnailed avatar or not
array $userinfo Array of userinfo, possibly already containing the avatar information

Return Value

array Information regarding the avatar

at line 1677
array fetchProfileFieldsForRegistration(array $userinfo = array())

Fetches the Profile Fields that needs to be displayed in Registration From

Parameters

array $userinfo User information as fields' current value

Return Value

array Profile fields

at line 1691
protected void _processProfileFields(array $profilefields, array $currentvalues)

Process Profile Fields for templates

Parameters

array $profilefields (ref) Profile fields (database records array) to be processed.
array $currentvalues Current values of the profile fields

Return Value

void

at line 1853
delete(integer $userid, bool $transfer_groups = true)

Delete a user

Parameters

integer $userid int The ID of user to be deleted
bool $transfer_groups boolean Whether to transfer the Groups and Blogs owned by the user to current logged-in admininstrator

at line 1882
protected integer saveEmailPassword(array $extra)

Shortcut to saving only email and password if user only has permission to modify password and email

Saves the email and password for the current logged in user.

Parameters

array $extra Generic flags or data to affect processing. *email -- email to set *newpass -- new password to set *password -- existing password to verify (we verify passwords before changing email/password)

Return Value

integer New or updated userid.

at line 1975
integer save(integer $userid, string $password, array $user, array $options, array $adminoptions, array $userfield, array $notificationOptions = array(), array $hvinput = array(), array $extra = array())

Insert or Update an user

Parameters

integer $userid Userid to be updated. Set to 0 if you want to insert a new user.
string $password Password for the user. Empty means no change. May be overriden by the $extra array
array $user Basic user information such as email or home page * username * email * usertitle * birthday * usergroupid (will get no_permissions exception without administrate user permissions) * membergroupids (will get no_permissions exception without administrate user permissions) * privacyconsent int -1|0|1 meaning Privacy-Consent Withdrawn|Unknown|Given respectively. * list not complete
array $options vB options for the user
array $adminoptions Admin Override Options for the user
array $userfield User's User Profile Field data
array $notificationOptions
array $hvinput Human Verify input data. see vB_Api_Hv::verifyToken()
array $extra Generic flags or data to affect processing. * registration * email * newpass * password * acnt_settings => 1 if we are editing the user as a normal user (suppresses adminoverride if the user is an admin.

Return Value

integer New or updated userid.

at line 2944
sendActivateEmail($email)

Parameters

$email

at line 2970
string activateUserByUsername(string $username, string $activateid)

Activate an user with an activate ID and Username

Parameters

string $username Username
string $activateid Activate ID

Return Value

string User status after activation. Possible values: 1) moderateuser: user is put into moderate queue 2) emailchanged: user's email address has been updated successfully 3) registration_complete: user's registration is completed

Exceptions

vB_Exception_Api

at line 2994
string activateUser(int $userid, string $activateid)

Activate an user with an activate ID

Parameters

int $userid User ID
string $activateid Activate ID

Return Value

string User status after activation. Possible values: 1) moderateuser: user is put into moderate queue 2) emailchanged: user's email address has been updated successfully 3) registration_complete: user's registration is completed

Exceptions

vB_Exception_Api

at line 3147
deleteActivation($userid, $activateid)

Parameters

$userid
$activateid

at line 3191
killActivation($userid, $activateid)

Parameters

$userid
$activateid

at line 3284
string saveSignature(string $signature, array $filedataids = array())

Verifies and saves a signature for current logged in user. Returns the signature.

Parameters

string $signature
array $filedataids

Return Value

string

at line 3501
array fetchAwaitingModerate()

Fetch a list of users who are awaiting moderate or Coppa

Return Value

array A list of users that are awaiting moderation

at line 3515
bool moderate(array $validate, bool $send_validated, bool $send_deleted)

Moderate users

Parameters

array $validate Validate information
bool $send_validated Whether to send email to users who have been accepted
bool $send_deleted Whether to send email to users who have been deleted

Return Value

bool True if user accounts validated successfully

at line 3656
array fetchPruneUsers($usergroupid, $includeSecondary, $daysprune, $minposts, $joindate, $order)

Return a list of users for pruning or moving

Parameters

$usergroupid
$includeSecondary
$daysprune
$minposts
$joindate
$order

Return Value

array Users to be pruned or moved

at line 3679
prune(array $userids, string $dowhat, integer $movegroup = 0)

Do prune/move users (step 1)

Parameters

array $userids UserID to be pruned or moved
string $dowhat 'delete' or 'move'
integer $movegroup Usergroup ID that the users are going to be moved

at line 3729
integer pruneUpdateposts(integer $startat)

Do prune/move users (step 2). Userids to be updated are stored in adminutil table.

Parameters

integer $startat Start at index.

Return Value

integer |bool Next startat value. True means all users have been updated.

at line 3775
array changeHistory(integer $userid)

Return user change history

Parameters

integer $userid

Return Value

array |bool User change history array. False means no change history.

at line 3830
merge(integer $sourceuserid, integer $destuserid)

Merge two users

Parameters

integer $sourceuserid
integer $destuserid

at line 4163
updateAvatar($userid, $avatarid, $data = array(), $cropped = false)

Update avatar

Parameters

$userid
$avatarid
$data
$cropped

at line 4328
updateSigPic(integer $userid, bool $delete, array $data = array())

Update profile picture

Parameters

integer $userid User ID whose profile picture is going to be updated
bool $delete Whether to delete profile picture of the user
array $data Picture data. It should be an array contains the following items: 'filename', 'width', 'height', 'filedata'

at line 4416
array getPrivacyConsentRequired()

Return if the privacy consent is required for the current session

This is based on the IP address. For security reasons we do not allow lookups for users other than the current session.

Return Value

array --'required' int -- 0 unknown -- 1 Privacy Consent Required -- 2 Privacy Consent Not Required

at line 4433
array searchIP(string $userid, integer $depth = 1)

Search IP Addresses

Parameters

string $userid An userid. Find IP Addresses for user.
integer $depth Depth to Search

Return Value

array 'regip' User's registration IP. 'postips' IP addresses which the user has ever used to post 'regipusers' Other users who used the same IP address to register

at line 4482
array searchUsersByIP(string $ipaddress, integer $depth)

Search IP Addresses

Parameters

string $ipaddress An IP Address. Find Users by IP Address.
integer $depth Search depth

Return Value

array 'postipusers' Users who used the IP address to post 'regipusers' Users who used the IP address to register

at line 4511
protected _searchRegisterIP($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_register_table()

Parameters

$ipaddress
$prevuserid
$depth

at line 4542
protected _searchUserIP($userid, $previpaddress, $depth = 2)

Rewrite function construct_user_ip_table()

Parameters

$userid
$previpaddress
$depth

at line 4568
protected _searchIPUsage($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_usage_table()

Parameters

$ipaddress
$prevuserid
$depth

at line 4603
array fetchReferrers(array $startdate, array $enddate)

Return a report of referrers

Parameters

array $startdate Start Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'
array $enddate End Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'

Return Value

array Referrers information

at line 4637
bool isBanned(integer $userid)

Check whether a user is banned.

Parameters

integer $userid User ID.

Return Value

bool Whether the user is banned.

at line 4661
bool isBannedEmail(string $email)

Check whether an email address is banned from the forums

Parameters

string $email The email address to check

Return Value

bool Whether the email is banned.

at line 4768
resetMfaSecret(string $password, string $mfa_authcode = null)

Reset the current user's MFA secret

Parameters

string $password -- the user's current password
string $mfa_authcode -- the authcode for the current secret, not required if the user does not currently have an auth secret

at line 4805
enableMfa(string $password, string $mfa_authcode)

Enable the user's current MFA record after verify password and authcode

Parameters

string $password -- the user's current password
string $mfa_authcode -- the authcode for the current secret, not required if the user does not currently have an auth secret

at line 4849
array setMfaEnabled(int $userid, bool $enabled)

Sets the users MFA record to enabled or disabled

Requires canadminusers permission

Parameters

int $userid
bool $enabled

Return Value

array ('success' => true)

at line 4865
isMfaEnabled(int $userid)

Gets whether or not the user has an enabled MFA record

Requires canadminusers permission

Parameters

int $userid @return array -- bool enabled

at line 4886
array needMFA(string $logintype)

Indicates if the current user needs to provide an MFA code for login.

Note that it's not entirely pointless to request this for a logged in user as we can still require a login for a cpsession even after a user is logged in.

Parameters

string $logintype -- either '', 'cplogin', 'modcplogin', 'mfareset' mfareset is a psuedo login where we reauthorize the login in order to change the mfa code.

Return Value

array -- bool enabled -- true if MFA auth is needed, false if not

at line 4949
array login($username, $password = null, $md5password = null, $md5password_utf = null, $logintype = null) deprecated

deprecated use login2

Login a user

Parameters

$username
$password
$md5password
$md5password_utf
$logintype

Return Value

array 'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"

at line 4982
array login2(string $username, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user

Parameters

string $username
array $passwords -- contains at least one of * string password -- plain text password * string md5password -- md5 encoded password (legacy) * string md5password_utf -- md5 encoded password with utf replacements (legacy)
array $extraAuthInfo -- information that might be required to authorize a user, such as numeric code for MFA
string $logintype

Return Value

array 'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"

at line 5020
array loginSpecificUser(int $userid, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user for which we have the userid

Parameters

int $userid
array $passwords -- contains at least one of * string password -- plain text password * string md5password -- md5 encoded password (legacy) * string md5password_utf -- md5 encoded password with utf replacements (legacy)
array $extraAuthInfo -- information that might be required to authorize a user, such as numeric code for MFA
string $logintype

Return Value

array 'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"

at line 5111
array. loginExternal($provider, $info, $userid = null)

Log in via a third party provider.

For now facebook is the only provider supported. We do not support control panel logins via external providers.

Parameters

$provider
$info
$userid

Return Value

array. 'login' => array (should match the return from "login" function). Only present if the login succeeded. 'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token" will always be blank for this method 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => will never be set for this function

at line 5380
bool logout($logouthash = null)

Logout user

Parameters

$logouthash Logout hash

Return Value

bool

at line 5409
bool emailPassword(integer $userid, string $email, array $hvinput = array())

Email user a password reset email

Parameters

integer $userid User ID
string $email Email address
array $hvinput Human Verify input data. see vB_Api_Hv::verifyToken()

Return Value

bool

at line 5424
string[] setNewPassword(integer $userid, string $activationid, string $newpassword)

Set a new password for a user. Used by "forgot password" function.

Parameters

integer $userid
string $activationid Activation ID
string $newpassword

Return Value

string[] keys 'password_reset' & 'setnewpw_message', values

at line 5518
protected processPasswordResetLockout($userinfo, $useractivation, $activationid)

Parameters

$userinfo
$useractivation
$activationid

at line 5627
int needsCoppa(array $dateInfo)

This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call

Parameters

array $dateInfo -- array of month/day/year.

Return Value

int 0 - no COPPA needed, 1 - Approve but require adult validation, 2 - Deny

at line 5638
bool useCoppa()

This checks whether the site uses COPPA review

Return Value

bool

at line 5650
bool checkUsername(username $candidate)

This checks whether the a username is available and valid

Parameters

username $candidate

Return Value

bool

at line 5721
currentUserHasAdminPermission($adminPermission)

Parameters

$adminPermission

at line 5754
array getAutocomplete(string $searchStr, string $orderby = 'username', string $direction = 'ASC', int $limitstart = 0, int $limitnumber = 15)

Returns suggested usernames for the username autocomplete popup menu.

Parameters

string $searchStr Text to search for, must be at least 3 chars long.
string $orderby Sort field, default 'username'
string $direction Sort order, default 'ASC'
int $limitstart [Not used, always starts from 0] Offset to start searching from, default 0
int $limitnumber Max number of suggestions to return, default 15, max 15

Return Value

array Array containing one element "suggestions" which is an array. Each element is an array containing: 'title' => username without html entities 'value' => username 'id' => userid

at line 5828
setDefaultAvatar(int $avatarid)

This sets a user to use one of the default avatars.

Parameters

int $avatarid

at line 5864
protected fetchUserSearchCondition($user, $profile, $prefix = 'user')

Convert the search array to the assertor conditions.

Refactored from adminfunctions_user.php fetch_user_search_sql

Parameters

$user
$profile
$prefix

at line 6162
array fetchSignature(int $userid)

Get the profile information so the presentation can render it

Parameters

int $userid userid

Return Value

array | false sigature information or false if there is an error or the user doesn't have a sigature. If the user is not permitted to have a signature, then they will be treated as not having one even if it doesn't exist. signature permissions dohtml dobbcode dobbimagecode dosmilies sigpic sigpicrevision sigpicdateline

at line 6215
protected getProfileFieldConditions($profilefield, $profile)

Parameters

$profilefield
$profile

at line 6292
array fetchBirthdays()

Fetch today's birthdays

Return Value

array birthday information

at line 6339
array fetchUsernames(array $userIds, bool $profileUrl = true)

Returns an array with the usernames for the user ids and optionally the profileUrl for the user

Parameters

array $userIds
bool $profileUrl
  • if true include the profileUrl field in the returned array.

Return Value

array -- array($userid => array('username' => $username, 'profileUrl' => $profileUrl))

at line 6363
protected updateIgnorelist(int $userid, String[] $userList)

Updates the user ignore list

Parameters

int $userid Update ignorelist for this user.
String[] $userList Usernames of ignored users.

at line 6491
String updateStatus(int $userid = false, String $status)

Updates the user status

Parameters

int $userid UserID
String $status Status to set

Return Value

String Updated status from user.

at line 6554
banUsers(array $userids, int $banusergroupid, string $period, string $reason = '')

Ban users

Parameters

array $userids Userids to ban
int $banusergroupid Which banned usergroup to move the users to
string $period Ban period
string $reason Ban reason

at line 6694
boolean|int hasPermissions(string $group, string $permission, boolean $nodeid = false)

Returns global permission value or specific value for a nodeid for current user.

Parameters

string $group
string $permission
boolean $nodeid (optional)

Return Value

boolean|int

at line 6724
integer canRemovePost(integer $nodeid)

Checks the various options as to whether the current user can physically remove a post

Parameters

integer $nodeid

Return Value

integer 0 or 1

at line 6768
boolean|int havePermissions(string $group, string $permission, array $nodeIds = array())

Returns permission values of a group of nodes for current user.

Parameters

string $group
string $permission
array $nodeIds

Return Value

boolean|int

See also

vB_Api_User::hasPermissions

at line 6802
inviteMembers($userIds, $userNames, $nodeId, $requestType)

Invites members to a given node channel passing either an array of userids or usernames.

Will combine the list of username with the list of userids to get the list of users to invite.

Parameters

$userIds
$userNames
$nodeId
$requestType

at line 6894
bool generateMailingList($user, $profile, $options = array())

Generates users mailing list for the given criteria.

Used for admincp - email sending and list generating.

Parameters

$user
$profile
$options

Return Value

bool |array False if no user found. Otherwise it returns users array as result. The array also contains a field that stores total found user's e-mail count.

at line 6938
array getUsersFromCriteria($user, $profile, $options = array())

Fetch users and info from a given user criteria Used for admincp - verticalresponse.

@param array $user An array of common conditions for user search

Parameters

$user
$profile
$options

Return Value

array $result Result which includes the 'users' => userlist and the 'totalcount'.

at line 6966
array fetchUsersPms($options = array())

Fetch private messages statistics from all the users.

Used for admincp - usertools private message statistics

Parameters

$options

Return Value

array $result Private messages grouped by userid (including some userinfo and pm total count).

at line 7004
fetchAdminUser()

This implements vB_PermissionContext::getAdminUser().

return int User id from a user that can administer the admincp

at line 7015
array fetchUserProfileFields()

This gets the current user profile fields from the database.

Return Value

array The title of the existing user profile fields.

at line 7040
string getUsertitleFromPosts(int $posts)

Get the user title regarding the given posts.

Parameters

int $posts Number of user posts.

Return Value

string User title.

at line 7069
array getPrivacyOptions()

Mostly a getter for user privacy options.

Return Value

array Existing user privacy options.

at line 7080
array getGitCanStart(int $parentNodeId)

This likes the channels below a parent node where a user can create starters based on groupintopic

Parameters

int $parentNodeId -- the ancestor node id

Return Value

array array of integer, title- the nodeids

at line 7094
1 canCreateBlogEntry(int $nodeid = 0)

Tells whether the current user can create a blog entry. That can be their own permissions or GIT.

Parameters

int $nodeid -- optional. If not passed will check the global blog channel.

Return Value

1 if the user can create a entry in the given channel. 0 otherwise

at line 7126
integer fetchTimeOffset($adjustForServer = false, $userid = false, $ignoreDST = false)

Adjust GMT time back to user's time Use "gm" versions of date/time functions with this offset, not ones that rely on current server's system timezone.

Parameters

$adjustForServer
$userid
$ignoreDST

Return Value

integer

at line 7178
integer vBMktime(array $dateInfo)

translate a year/month/day/hour/minute to a Unix timestamp.

Parameters

array $dateInfo -- array of year, month, day, hour, minute, second. Year and month are required.

Return Value

integer -- Unix Timestamp, corrected for the user's time setting

at line 7238
userTimeStrToUnixtimestamp($strTime, $userid = false, $ignoreDST = true)

Parameters

$strTime
$userid
$ignoreDST

at line 7272
unixtimestampToUserDateString($timestamp, $userid = false, $format = "Y-m-d H:i:s", $ignoreDST = true)

Parameters

$timestamp
$userid
$format
$ignoreDST

at line 7364
updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

Parameters

bool $consent True if consenting, false otherwise

at line 7379
setPrivacyConsent(int $userid, array $data = array())

Set privacy consent and eu status for user

Parameters

int $userid User ID
array $data Array containing one or both keys "eustatus" or "privacyconsent"

at line 7416
array getPersonalData($userid = 0)

Returns a report on "personal information" for a user

This is the personally identifiable information for privacy laws. Currently this follows our best understanding of the EU law, but eventually this may end up being a superset of all simpilar laws.

Parameters

$userid (optional)

Return Value

array of information. See the library function for full listing.

at line 7454
array verifyFlashMessageSignature(string $phrase, string $timestamp, string $hash)

Verifies that a flash message passed through the URL is signed and valid

Parameters

string $phrase Phrase key
string $timestamp Timestamp for the securitytoken
string $hash The hash sha1(phrase + securitytoken)

Return Value

array Returns success=>true in the array if the message is valid.

at line 7496
array saveEditorState(string $action, int $value)

Saves the content entry UI editor "state" where state is the show/hide state of the following 3 content entry UIs: ckeditor toolbar, attachements panel, and smilies panel.

Parameters

string $action Action -- 'add' (the panel is visible) or 'remove' (the panel is hidden)
int $value The int bit value to add or remove from the editorstate. 1=toolbar, 2=attachments, 4=smilies

Return Value

array Array containing success and the current editor state