Vanilla 1 Documentation Archive

 
 
vanilla:vanilla_usermanager.html

~~NOTOC~~ ====== Class Library: People ====== ===== Class UserManager extends Framework::Delegation ===== ==== Overview: ==== ---- The UserManager class is a [[Vanilla/Delegation.html|Delegation]], containing methods for manipulating user account settings and history. ==== Fields: ==== ---- === Name === The name of this class (hardcoded). === Context === A handle to the global [[Vanilla/Context.html|Context]] object. Required for database operations. ==== Methods: ==== ---- === UserManager [constructor] === == Signature: == <code php>$UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager');</code> == Description: == Creates a new UserManager object using the given [[Vanilla/Context.html|Context]] handle. This class will not behave properly without a valid [[Vanilla/Context.html|Context]]. === AddBookmark === == Signature: == <code php>[void] AddBookmark($UserID, $DiscussionID)</code> == Description: == Inserts a record containing the given user id and discussion id into the UserBookMark table, indicating that the user has bookmarked the discussion. === AddCategoryBlock === == Signature: == <code php>[void] AddCategoryBlock($CategoryID)</code> == Description: == Inserts a record containing the id of the authenticated user, and the given category id, into the CategoryBlock table to indicate that the user is blocking that category. If successful, the User table is updated for the same user id, to indicate that the user is blocking categories. === AddCommentBlock === == Signature: == <code php>[void] AddCommentBlock($CommentID)</code> == Description: == Inserts a record containing the id of the authenticated user, and the given comment id, into the CommentBlock table to indicate that the user is blocking that comment. === AddUserBlock === == Signature: == <code php>[void] AddUserBlock($UserID)</code> == Description: == Inserts a record containing the id of the authenticated user, and the given user id, into the UserBlock table to indicate that the user is blocking that user. === ApproveApplicant === == Signature: == <code php>[boolean] ApproveApplicant($ApplicantID)</code> == Description: == Converts the argument to an array if it isn't one already, then iterates over the array, assigning the configured membership role to each approved applicant. Returns a truth value if no errors occur, and a false value otherwise. === AssignRole === == Signature: == <code php>[boolean] AssignRole($UserRoleHistory, $NewUser = '0')</code> == Description: == Updates the database with the contents of the given [[Vanilla/UserRoleHistory.html|UserRoleHistory]] object. If the second parameter is false, the user is then notified by e-mail of the change. (The "PreRoleChangeNotification" delegate is called prior to sending mail. See the delegates section below for more information.) The second parameter indicates (if true) that the request is coming from an applicant, meaning no permission checks are necessary. Otherwise, the authenticated user must have permission either to approve applicants or change roles. The returned value is a truth value if the user's permissions are adequate, the user remembered (where applicable) to enter a comment for the role change, and the database update and mailing are successful; false otherwise. === ChangePassword === == Signature: == <code php>[boolean] ChangePassword($User)</code> == Description: == Updates the given user's password in the database, provided the necessary conditions are met. If the user is attempting to update another user's password and is not permitted to do so, or the 'confirmation' password entry doesn't match the desired new password, or the supplied current password for the account is incorrect, or if the new password is missing or excessively long, or any of the database operations fail, an error is issued. The return value is a truth value if the operation is successful, and false otherwise. === CreateUser === == Signature: == <code php>[boolean] CreateUser(&$User)</code> == Description: == Inserts the contents of the given [[Vanilla/User.html|User]] object into the database, provided the following are satisfied: * The e-mail address is valid, and not more than 200 characters in length. * The username is not more than 20 characters in length. * The password is not more than 50 characters in length, and matches the confirmation-password value from the form. * The user agreed to the terms of service. * The username is not already taken. If any of these conditions are not satisfied, a warning is issued and the user is not created. After a successful insertion, this method assigns a role to the new user, and sends an e-mail to users having both the permission to review applicants, and have set the preference to receive such notifications. No error message is issued if the notification fails. The following delegates are called by this method: * PostValidation - After the [[Vanilla/User.html|User]] object is deemed valid. * PreDataInsert - Before the user record is created in the database. * PostRoleAssignment - After a role is assigned to the new user. * PreNewUserNotification - Before administrators are notified of the new user. See the Delegates section below, for more information. This method returns a truth value if the argument is deemed valid, and both the user-record insertion and role assignment are successful; false otherwise. === GetApplicantCount === == Signature: == <code php>[integer] GetApplicantCount()</code> == Description: == Returns a count of users assigned to role id '0', or '0' if unable to query the database. === GetIpHistory === == Signature: == <code php>array[array] GetIpHistory($UserID)</code> == Description: == Queries the IpHistory table and returns an array of arrays containing the following keys: * IP - The IP address recorded for the user. * Usagecount - The number of times the user logged in from that IP. * SharedWith - Array of arrays of users that have logged in from that IP. (Keys: UserID, Name) This method issues an error (to the [[Vanilla/Context.html|Context]]) if the database query fails. === GetSearchBuilder === == Signature: == <code php></code> == Description: == === GetSessionDataById === == Signature: == <code php></code> == Description: == === GetUserBuilder === == Signature: == <code php>SqlBuilder GetUserBuilder()</code> == Description: == Returns a [[Vanilla/SqlBuilder.html|SqlBuilder]] object pre-populated to select user data. === GetUserById === == Signature: == <code php>User/[boolean] GetUserById($UserID)</code> == Description: == Queries the database for a user record matching the given user id, provided that the argument is greater than 0. If one or more records are found, a [[Vanilla/User.html|User]] object is populated with the last matching record. The return value is a boolean false if no records are found, or the argument isn't a positive number. Otherwise, the [[Vanilla/User.html|User]] object representing the matching record is returned. === GetUserIdByName === == Signature: == <code php>[int] GetUserIdByName($Username)</code> == Description: == Queries the database for user ids matching the given user name, and returns either the id from the last matching record (if records are found and the database operation is successful), or 0. === GetUserRoleHistoryByUserId === == Signature: == <code php>[data set] GetUserRoleHistoryByUserId($UserID)</code> == Description: == Returns a data set containing the history of role assignments for the given user id. === GetUsersByIp === == Signature: == <code php>[data set] GetUsersByIp($Ip)</code> == Description: == Returns a data set containing user names and ids for users that have logged in from the given IP address. === GetUsersByRoleId === == Signature: == <code php>[data set] GetUsersByRoleId($RoleID, $RecordsToReturn = '0')</code> == Description: == Returns a data set of user data (sufficient for populating [[Vanilla/User.html|User]] objects) for users belonging to the given role id. If the second parameter is a positive number, the number of records in the data set is limited to that value. === GetUserSearch === == Signature: == <code php>[data set] GetUserSearch($Search, $RowsPerPage, $CurrentPage)</code> == Description: == Executes the given [[Vanilla/Search.html|Search]], and returns a data set containing the results. If the second parameter is a positive number, then the number of records returned is limited by that value. If the third parameter is a positive number, then its value and the value of the second parameter are used to calculate the offset for the first record to return. === LogIp === == Signature: == <code php></code> == Description: == === RemoveApplicant === == Signature: == <code php></code> == Description: == === RemoveBookmark === == Signature: == <code php></code> == Description: == === RemoveCategoryBlock === == Signature: == <code php></code> == Description: == === RemoveCommentBlock === == Signature: == <code php></code> == Description: == === RemoveUserBlock === == Signature: == <code php></code> == Description: == === RequestPasswordReset === == Signature: == <code php></code> == Description: == === ResetPassword === == Signature: == <code php></code> == Description: == === SaveIdentity === == Signature: == <code php></code> == Description: == === SaveStyle === == Signature: == <code php></code> == Description: == === SaveUserCustomization === == Signature: == <code php></code> == Description: == === SaveUserCustomizationsFromForm === == Signature: == <code php></code> == Description: == === SaveUserPreferences === == Signature: == <code php></code> == Description: == === SetDefaultFormatType === == Signature: == <code php></code> == Description: == === SwitchUserPreference === == Signature: == <code php></code> == Description: == === SwitchUserProperty === == Signature: == <code php></code> == Description: == === UpdateUserBlogCount === == Signature: == <code php></code> == Description: == === UpdateUserCommentCount === == Signature: == <code php></code> == Description: == === UpdateUserDiscussionCount === == Signature: == <code php></code> == Description: == === ValidateUser === == Signature: == <code php></code> == Description: == === ValidateUserCredentials === == Signature: == <code php></code> == Description: == === VerifyPasswordResetRequest === == Signature: == <code php></code> == Description: == ==== Delegates ==== ---- Below are the delegate functions called by members of this class. A note about delegate parameters: the parameter names listed for each delegate below may not be strictly applicable to that delegate, but are listed because they are in scope. I've attempted to note those which are stale and effectively unusable, at the point in which the delegate is called. --- //[[Matt Brown (mattucf)]] 2007/08/07 13:38// === PreRoleChangeNotification === Called from AssignRole... == Delegate Parameters: == * AffectedUser - * EmailBody - === PostValidation === Called from CreateUser... == Delegate Parameters: == * User === PreDataInsert === Called from CreateUser... == Delegate Parameters: == * User - * SqlBuilder - === PostRoleAssignment === Called from CreateUser... == Delegate Parameters: == * User - * SqlBuilder - stale query parameter used during role assignment. === PreNewUserNotification === Called from CreateUser... == Delegate Parameters: == * User - * EmailBody - * SqlBuilder - stale query parameter used during role assignment. === PreDefineSearch === Called from GetSearchBuilder... == Delegate Parameters: == * SqlBuilder - === PreIdentityUpdate === Called from SaveIdentity... == Delegate Parameters: == * User - * SqlBuilder -

 
 
 
 
vanilla/vanilla_usermanager.html.txt · Last modified: 2009/03/28 14:10
Vanilla 1 Documentation archive (Wiki by DokuWiki)