Manual and Documentation

NOTE: This manual describes HammerKit version 3.5. To view documentation for the current release of HammerKit Studio, please go to http://manual.hammerkit.com/
search
Index / D. Object API / Classes / HammerKit_User

A. Introduction
B. Installation and Configuration
C. Using HammerKit tools
D. Object API
Classes
Button
FileUtils
HammerKit_BasicFile
HammerKit_Color
HammerKit_ColorPalette
HammerKit_Component
HammerKit_Converter
HammerKit_CssRule
HammerKit_Db
HammerKit_DbQueryResult
HammerKit_Document
HammerKit_Element
HammerKit_File
HammerKit_GenericObject
HammerKit_Image
HammerKit_Keyword
HammerKit_ObjectCache
HammerKit_ObjectList
HammerKit_Session
HammerKit_Shortcut
HammerKit_Site
HammerKit_System
HammerKit_User
HammerKit_UserGroup
HammerKit_VariableHandler
Style
Interfaces
Object Choosers
Global Variables
Modules
Tools
Converters
Using the API
E. HammerScript
F. Access Rights
HammerKit_User


Implements interface: HammerKit_ObjectInterface

This class describes and contains the functionality for adding, removing and managing users and their attributes. A user is uniquely identified by its id or username attribute.



Attributes

boolean active
Description:
Settable: yes

integer(File) avatar
Description: avatar image for the user
Settable: yes

string box
Description: post office box
Settable: yes

string city
Description: city name
Settable: yes

string company
Description: company name
Settable: yes

string country
Description: country name
Settable: yes

string description
Description: description of the user
Settable: yes

string email
Description: e-mail address
Settable: yes

boolean email_active
Description: determines if the user is active for receiving e-mails from HammerKit
Settable: yes

string fax
Description: fax number
Settable: yes

string firstname
Description: first name of the user
Settable: yes

string fullname
Description: attributes firstname and lastname combined by a space
Settable: no

string folder
Description: the id of the user's file folder
Settable: no

unique integer(User) id
Description: the database number of the user
Settable: no

integer(File) image
Description: an image of the user
Settable: yes

string ip
Description: the IP-address of the user
Settable: yes

string lastname
Description: last name of the user
Settable: yes

boolean marketing_deny
Description: determines if the user has activated the marketing deny, means usually that the attribute email_active is allways interpreted as FALSE
Settable: yes

Usergroup[] memberships
Description: a list of usergroup ids of the usergroups a user is member of
Settable: no

string mobile
Description: mobile phone number
Settable: yes

string origin
Description: the name of the site where the user was created
Settable: yes

component page
Description: a component linked to the user
Settable: yes

string password
Description: the encrypted password of the user
Settable: yes

string rights
Description: the rights level of the user
Possible values: "USR", "ADM" or "SYS"
Settable: yes

string street
Description: a street address
Settable: yes

string tel
Description: telephone number
Settable: yes

string title
Description: the title of the component
Settable: yes

string url
Description: a URL for the user
Settable: yes

time update_time
Description: the time the user's information was last updated
Settable: yes

unique string username
Description: the username of the user
Settable: yes

time valid_from
Description: the time from which the user is valid
Settable: yes

time valid_to
Description: the time to which the user is valid
Settable: yes

array variables
Description: an array containing key-value pairs of variables
Settable: yes

string zip
Description: zip code
Settable: yes


Methods

constructor __construct(mixed identifier, boolean from_username)
Description: creates a user object
Arguments: identifier is either the id number or the username of the user to create, from_username determines if identifier should be interpreted as a username - default is FALSE
Returns: a component object

integer(User) add(array attributes)
Description: creates a new user into the database
Arguments: an array of User attributes where key is the attribute name and value the value of the attribute
Returns: the id of the created user on success, otherwise FALSE

boolean addMembership(integer usergroup_id)
Description: Adds the user as a member to a user group.
Arguments: usergroup_id is an id of a valid user group
Returns: TRUE on success and false otherwise

string getAttribute(string attribute [, boolean formatted [, array format_options]])
Description: see the description of the HammerKit_ObjectInterface interface

array getAttributeList([string parameter])
Description: see the description of the HammerKit_ObjectInterface interface

string getChooser(string name [, string value [, array specials [, array settings [, array options]]]])
Description: see the description of the HammerKit_ObjectInterface interface

array getKeywords(void)
Description: get a list of keywords that a user is linked to
Returns: an array of Keyword ids

HammerKit_ObjectList(User) getList([array where])
Description: see the description of the HammerKit_ObjectInterface interface

array getMemberships(void)
Description: Get a list of user groups that a user is a member of
Returns: An array of Usergroup object ids.

boolean isActive(void)
Description: check if a user is active
Returns: TRUE if the user is active and FALSE otherwise

boolean remove(void)
Description: see the description of the HammerKit_ObjectInterface interface

boolean removeMembership(integer usergroup_id)
Description: remove the user's membership from usergroup
Arguments: usergroup_id is an id of a valid usergroup
Returns: TRUE on success and false otherwise

boolean setAttributes(array attributes)
Description: see the description of the HammerKit_ObjectInterface interface

boolean usernameExists(string username)
Description: check if a given username already exists
Arguments: username is the username to check
Returns: TRUE if the username exists, otherwise FALSE



� HammerKit Oy 2008 UPDATED: 02.12.2008 15:15