Fetching Users
User Fields
| Field | Description |
|---|---|
| user_id | Unique User ID |
| username | Unique Username |
| password | Hashed password |
| password_last_set | Timestamp of when the user's password was last set |
| password_never_expires | Boolean value, set to TRUE and the user's password will never expire. |
| remember_me | "Remember Me" token, if the user has a currently active "remember me" login |
| activation_code | Random hash for activation code, if this option is enabled in the configuration |
| active | Whether user is active or not |
| enabled | Whether user is enabled or not. If FALSE, user will not show up by default in any queries for fetching users |
| last_login | Timestamp of when the user last logged in |
| last_login_ip | IP the user last logged in from |
| groups | Array of group_ids the user is a member of |
| roles | Numeric representation of the user's inherited roles. You cannot set this value directly on the user. |
Along with all of this information, any custom user data you may have is also returned. You can access and edit this information exactly as you would any other user information.
$this->bitauth->get_users($include_disabled = FALSE)
Returns all users. Each user object contains the information listed above. By default, any users with enabled = 0 will be excluded. Pass TRUE as the second parameter to override this. For information on disabled/deleted users see Disabling/Deleting Users.
$all_users = $this->bitauth->get_users();
foreach($all_users as $user)
{
echo $user->username.'<br/>';
}
For information on checking a user's roles, see Checking Roles.
For information on customizing user data, see Customizing User Data.
$this->bitauth->get_user_by_id($user_id, $include_disabled = FALSE)
Returns an object with the same information as get_users() for one user, by user_id. Returns FALSE on failure.
$user = $this->bitauth->get_user_by_id(1);
if($user == FALSE)
{
echo 'User Not Found';
}
else
{
echo 'Username: '.$user->username;
}
$this->bitauth->get_user_by_username($username, $include_disabled = FALSE)
Returns an object with the same information as get_users() for one user, by username. $username is case-insensitive. Returns FALSE on failure.
$this->bitauth->get_user_by_activation_code($activation_code)
Fetches a user by activation code, called by activate().
$this->bitauth->get_user_by_forgot_code($forgot_code)
Fetches a user by forgot password code. If the code has expired, it is removed and FALSE is returned.