User
The User model.
See Also
Summary
| User | The User model. |
| Functions | |
| __construct | Model::grab |
| find | Model::search |
| authenticate | Checks to see if a given Login and Password match a user in the database. |
| add | Adds a user to the database with the passed username, password, and e-mail. |
| update | Updates the user with the given login, password, full name, e-mail, website, and Group ID. |
| delete | Deletes a given user. Calls the delete_user trigger and passes the User as an argument. |
| hashPassword | Creates a secure hash of a user’s password. |
| checkPassword | Checks a given password against the stored hash. |
| group | Returns a user’s group. Example: $user->group->can(“do_something”) |
| posts | Returns all the posts of the user. |
| pages | Returns all the pages of the user. |
add
| static function add( | $login, | |||
| $password, | ||||
| $email, | ||||
| $full_name | = | "", | ||
| $website | = | "", | ||
| $group_id | = | null, | ||
| $joined_at | = | null | ) |
Adds a user to the database with the passed username, password, and e-mail.
Calls the add_user trigger with the inserted user.
Parameters
| $login | The Login for the new user. |
| $password | The Password for the new user. Don’t hash this, it’s done in the function. |
| The E-Mail for the new user. |
Returns
The newly created User.
See Also
update
| public function update( | $login | = | null, | |
| $password | = | null, | ||
| = | null, | |||
| $full_name | = | null, | ||
| $website | = | null, | ||
| $group_id | = | null, | ||
| $joined_at | = | null | ) |
Updates the user with the given login, password, full name, e-mail, website, and Group ID.
Passes all of the arguments to the update_user trigger.
Parameters
| $login | The new Login to set. |
| $password | The new Password to set, already encoded. |
| $full_name | The new Full Name to set. |
| The new E-Mail to set. | |
| $website | The new Website to set. |
| $group_id | The new Group to set. |
See Also
delete
| static function delete( | $id | ) |
Deletes a given user. Calls the delete_user trigger and passes the User as an argument.
Parameters
| $id | The user to delete. |