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. |
| 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. |
| edit_link | Outputs an edit link for the user, if they can edit_user. |
| delete_link | Outputs an delete link for the user, if they can delete_user. |
add
| static function add( | $login, | |||
| $password, | ||||
| $email, | ||||
| $full_name | = | "", | ||
| $website | = | "", | ||
| $joined_at | = | null, | ||
| $group_id | = | null | ) |
Adds a user to the database with the passed username, password, and e-mail.
Calls the add_user trigger with the inserted ID.
Parameters
| $login | The Login for the new user. |
| $password | The Password for the new user. Don’t MD5 this, it’s done in the function. |
| The E-Mail for the new user. |
Returns
| $id | The newly created users ID. |
See Also
update
| public function update( | $login, | |
| $password, | ||
| $email, | ||
| $full_name, | ||
| $website, | ||
| $group_id | ) |
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. |
| $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. |
delete_link
| public function delete_link( | $text | = | null, | |
| $before | = | null, | ||
| $after | = | null | ) |
Outputs an delete link for the user, if they can delete_user.
Parameters
| $text | The text to show for the link. |
| $before | If the link can be shown, show this before it. |
| $after | If the link can be shown, show this after it. |