class vB_Library_User extends vB_Library

vB_Library_User

Traits

Constants

PASSWORD_RESET_ATTEMPTS

PASSWORD_RESET_LOCK_MINUTES

Properties

static protected $instance from vB_Library

Methods

__sleep()

No description

__wakeup()

No description

__construct()

No description

static vB_PageCache
instance($class)

Returns singleton instance of self.

static 
getLibraryClassNameInternal($controller)

No description

static 
getContentInstance($contenttypeid)

No description

static 
clearCache()

No description

bool
isBanned(integer $userid)

Check whether a user is banned.

fetchBannedInfo(int $userid)

Check whether a user is banned and returns info such as reason and liftdate if possible.

string
fetchUserName(integer $userid)

Fetches the username for a userid

array
fetchUserNames(array $userIds)

Fetches the user names for the given user ids

array
fetchUserWithPerms(integer $userid, integer $languageid = 0, boolean $nocache = false, boolean $lastactivity = false)

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

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

Delete a user

array
getPersonalData($userid)

Returns a report on "personal information" for a user

getDayOfWeekPhrases()

No description

getRawCustomFields($userid)

No description

getCustomFields($userid, $showHidden)

No description

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

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

array
fetchModerator(integer $userid, array $moderators = false)

Fetches an array containing all the moderator permission informationd

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
fetchUserGroups(int $userid)

Gets the usergroup information. Returns the secondary groups even if allowmembergroups usergroup option is set to No.

none
addSecondaryUserGroups(integer $userid, array $groups)

Adds groups to a user

none
removeSecondaryUserGroups(integer $userid, array $groups)

Remove groups from a user

checkPasswordResetLock(array $useractivation)

No description

sendPasswordEmail($userid, $email)

No description

sendActivateEmail($userid)

No description

int
needsCoppa(array $dateInfo)

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

preloadUserInfo(array $userids)

This preloads information for a list of userids, so it will be available for userContext and other data loading

clearChannelPerms(int $userid)

This method clears remembered channel permission

updateEmailFloodTime()

No description

uploadAvatar($filename, $crop = array(), $userid = false, $adminoverride = false)

No description

transferOwnership($fromuser, $touser)

Transfers all ownerships (blogs and groups) from given user to another one.

string
generateUserSecret()

Generates a totally random string

none
incrementPostCountForUsers(array $userInfo)

Update the post count for a list of users.

none
decrementPostCountForUsers(array $userInfo)

Update the post count for a list of users.

clearUserInfo($userids)

Clear user cached info for given userids.

int
getPrivacyConsentRequired(string $ipaddress)

Return if the privacy consent is required for given IP address

cleanIpInfo()

Delete the old IP cache data

updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

array
getEmailReplacementValues(string $email)

Returns the values for the user-related phrase shortcodes, for use in emails.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 24
protected __construct()

in vB_Library at line 35
static vB_PageCache instance($class)

Returns singleton instance of self.

Parameters

$class

Return Value

vB_PageCache
  • Reference to singleton instance of the cache handler

in vB_Library at line 52
static protected getLibraryClassNameInternal($controller)

Parameters

$controller

in vB_Library at line 91
static getContentInstance($contenttypeid)

Parameters

$contenttypeid

in vB_Library at line 99
static clearCache()

at line 36
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 49
fetchBannedInfo(int $userid)

Check whether a user is banned and returns info such as reason and liftdate if possible.

Parameters

int $userid

at line 105
string fetchUserName(integer $userid)

Fetches the username for a userid

Parameters

integer $userid User ID

Return Value

string

at line 122
array fetchUserNames(array $userIds)

Fetches the user names for the given user ids

Parameters

array $userIds

Return Value

array $usernames -- format array($userid => $username)

at line 154
array fetchUserWithPerms(integer $userid, integer $languageid = 0, boolean $nocache = false, boolean $lastactivity = false)

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

Parameters

integer $userid
integer $languageid -- 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.
boolean $lastactivity -- unused

Return Value

array The information for the requested user

at line 218
delete(integer $userid, bool $transfer_groups = true, integer $transferee = null)

Delete a user

Parameters

integer $userid The ID of user to be deleted
bool $transfer_groups Whether to transfer the Groups and Blogs owned by the user to $transferee
integer $transferee ID of user that will receive the groups & blogs owned by deleted user.

at line 372
array getPersonalData($userid)

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

Return Value

array --string username --string email --string icq --string aim --string yahoo --string msn --string skype --string google --string usertitle --int lastvisit --int lastactivity --int lastpost --int posts --string reputation --int reputationlevelid --string timezoneoffset --string ipaddress --int pmtotal --string fbuserid --int fbjoindate --string fbname --string logintype --int infractions --int warnings --string reputationlevelphrase --string startofweekphrase --string language --string birthday --array(string) devicetokens --array customFields --array {categoryname} -- multiple arrays of categoryname => field -- array {fieldphrase} -- mutple array of fieldphrase => field details --mixed val --int hidden

at line 447
getDayOfWeekPhrases()

at line 460
getRawCustomFields($userid)

Parameters

$userid

at line 475
getCustomFields($userid, $showHidden)

Parameters

$userid
$showHidden

at line 601
array getGroupInTopic($userid, $nodeid = false, $forceReload = false)

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

Parameters

$userid
$nodeid
$forceReload

Return Value

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

at line 658
array fetchModerator(integer $userid, array $moderators = false)

Fetches an array containing all the moderator permission informationd

Parameters

integer $userid
array $moderators of $moderator records for user

Return Value

array the permission array

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 location - Process user's online location 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
array $option --(see description)
integer $languageid -- 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 818
array fetchUserGroups(int $userid)

Gets the usergroup information. Returns the secondary groups even if allowmembergroups usergroup option is set to No.

Parameters

int $userid userid

Return Value

array with * groupid integer primary group id * displaygroupid integer display group id * secondary array list of secondary user groups * infraction array list of infraction groups.

Exceptions

vB_Exception_Api invalid_user_specified

at line 882
none addSecondaryUserGroups(integer $userid, array $groups)

Adds groups to a user

Will not add a group if it matches the user's primary group is set to that group Will add groups even if allowmembergroups is set to "no". There will be cases where we want to track secondary group changes even if we aren't doing anything with them

Does not validate that the usergroupids are valid

Parameters

integer $userid
array $groups list of integer ids for usergroups to add

Return Value

none

at line 925
none removeSecondaryUserGroups(integer $userid, array $groups)

Remove groups from a user

Will not affect the user's primary group Will unset (set to 0) the display groupid if its being removed Will remove groups even if allowmembergroups is set to "no". There will be cases where we want to track secondary group changes even if we aren't doing anything with them

Parameters

integer $userid
array $groups list of integer ids for usergroups to remove

Return Value

none

at line 976
checkPasswordResetLock(array $useractivation)

Parameters

array $useractivation Record to check. Must have 'reset_locked_since'

at line 1013
sendPasswordEmail($userid, $email)

Parameters

$userid
$email

at line 1062
sendActivateEmail($userid)

Parameters

$userid

at line 1148
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 1223
preloadUserInfo(array $userids)

This preloads information for a list of userids, so it will be available for userContext and other data loading

Parameters

array $userids

at line 1322
clearChannelPerms(int $userid)

This method clears remembered channel permission

Parameters

int $userid

at line 1327
updateEmailFloodTime()

at line 1343
uploadAvatar($filename, $crop = array(), $userid = false, $adminoverride = false)

Parameters

$filename
$crop
$userid
$adminoverride

at line 1548
transferOwnership($fromuser, $touser)

Transfers all ownerships (blogs and groups) from given user to another one.

@param int Userid to transfer ownerships from.

Parameters

$fromuser
$touser

at line 1585
string generateUserSecret()

Generates a totally random string

Intended to populate the user secret field. Exposed as a function because the installer doesn't use the normal user save code and will need access.

Return Value

string Generated String

at line 1616
none incrementPostCountForUsers(array $userInfo)

Update the post count for a list of users.

The simple case is one user and one post, but if we do a large operation -- for example undeleting a topic -- we can cause a number of posts to be "counted" for a number of users (and have more than one "new" post per user). We batch the call for all affected users because it allows us to avoid

We also update the lastpost information for the user (conditionally). These are linked primary to save queries to the database because they tend to change together rather than because the are conceptually the same thing.

Parameters

array $userInfo of $userid => $info array with the following fields * posts -- the number of new posts for the user * lastposttime -- the publish time of the most recent "activated" post. This will become the user's last post IF it's more recent than the one we have on record * lastpostid -- the id of the last post

Return Value

none

at line 1676
none decrementPostCountForUsers(array $userInfo)

Update the post count for a list of users.

The simple case is one user and one post, but if we do a large operation -- for example deleting a topic -- we can cause a number of posts to be "uncounted" for a number of users (and have more than one "new" post per user). We batch the call for all affected users because it allows us to avoid

Parameters

array $userInfo of $userid => $info array with the following fields. This is structured this way to be consistant with the data for incrementPostCountForUsers * posts -- the number of removed posts for the user

Return Value

none

at line 1846
clearUserInfo($userids)

Clear user cached info for given userids.

There's currently cached info in several places (vB_Session, vB_User and vB_Cache implementations) this makes sure they all properly cleared.

Parameters

$userids

at line 1896
int getPrivacyConsentRequired(string $ipaddress)

Return if the privacy consent is required for given IP address

Parameters

string $ipaddress

Return Value

int -- 0 unknown -- 1 Privacy Consent Required -- 2 Privacy Consent Not Required

at line 1951
cleanIpInfo()

Delete the old IP cache data

at line 1970
updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

This saves a new record for each consent "event", even if the IP address is the same, because we have no way of knowing if it's the same person or not. If a saved consent "event" for a given time and IP address needs to be retrieved, this will give us the greatest likelihood of finding it.

Parameters

bool $consent True if consenting, false otherwise

at line 1999
array getEmailReplacementValues(string $email)

Returns the values for the user-related phrase shortcodes, for use in emails.

These correspond to the recipient user.

Parameters

string $email Recipient's email address

Return Value

array Array of replacement values