Useradmin

Summary
Useradmin
AuthorJaybill McCarthy
Licensehttp://communit.as/docs/license
See AlsoCts_Controller_Action_Abstract Cts_Controller_Action_Admin
Instance Methods
initInvoked automatically when an instance is created.
Actions
indexThe user administration landing page.
editThe page for administrators to edit users.
deleteDeletes a user.
testdataAdds a bunch of test users with random but plausible data.

Author

Jaybill McCarthy

Instance Methods

init

function init()

Invoked automatically when an instance is created.  For this class, does nothing other than initialize the parent object (calls init() on the parent instance).

Actions

index

function indexAction()

The user administration landing page.

HTTP GET or POST Parameters

pageThe number of the current page in the listing of users.
searchtermA string with a term or terms to search for users with.

Registry Values

useradmin_users_per_pageAn integer for the number of users to show per admin page.

Plugin Hooks

  • useradmin_index_post_select (filter) - Allows you to affect the current array of users before displaying it on the page.
param usersThe array of users to affect.

View Variables

searchtermThe string submitted as a user list search term.
usersThe array of users to display for the current page.

edit

function editAction()

The page for administrators to edit users.  Either displays an edit form, or processes the form, depending on whether the HTTP Request is GET or POST.  If the username is invalid, the browser is redirected to ‘/auth/missing’ (currently hardcoded).

HTTP GET or POST Parameters

aboutmeTBD
Birthday_DayThe user’s birth day.
Birthday_MonthThe user’s birth month.
Birthday_YearThe user’s birth year.
confirmTBD
country_codeThe user’s country code.
emailThe user’s email address.
genderUser’s gender, if chosen
newpasswordif both this and confirm are set and match, password will be changed
confirmsee newpassword
role_idrole id of the user being edited
tagsstring containing comma seperated tag list
usernameusername of user being editied

Plugin Hooks

  • useradmin_edit_pre_render (filter) - Allows you to affect the user before the page is displayed.  Commonly used for adding custom attributes.
param userThe user to be affected.
param requestThe entire HTTP Request.
  • useradmin_edit_pre_save (action) - Allows you to affect the user before it is saved to the database.

View Variabes

countriesAnd array of all countries pulled from the database.
end_yearthe last year a birthday can have. uses the minimum age param in the registry
errorsAn array of error messages.  Only exists if errors occurred.
gendersarray of gender options
paramsAll params in the param arrays for filters get turned into view variables automatically.
rolesarray of roles this user could have
successsuccess message, if there is one
errorsarray of errors, if there are any
tagscomma separated list of tags for this user
userThe user object to be edited

delete

function deleteAction()

Deletes a user.  After a successful deletion, the browser is redirected to ‘/useradmin’ (currently hardcoded).

HTTP POST Parameters

delIf the value is yes, the user will be deleted, otherwise the browser will just be redirected to ‘/useradmin’ (currently hardcoded).

Plugin Hooks

  • useradmin_delete_pre_delete (filter) - Allows you to change whether or not the user’s row is actually deleted from the database.  This is useful if you want to, for instance, mark users as deleted instead of actually deleting all their data.
param usernameThe username of the user to be deleted.
param delete_rowA boolean to determine whether the user’s row in the database should be deleted or not.  Defaults to true.
  • useradmin_delete_post_delete (action) - Allows you to trigger actions after the user has been deleted.

View Variables

pagetitleThe HTML page title.
userThe user to delete.

testdata

function testdataAction()

Adds a bunch of test users with random but plausible data.

HTTP GET or POST Parameters

Registry Values

test_data_pathif set, will be used as a default param for where to look for test data

Plugin Hooks

  • useradmin_testdata_precommit (filter) - fires after the test user data is created but before saving it to the db.  Fires once for each user.  Useful for plugins that want to add additional uaser data or modify the sample data as it’s created.
param userthe array containing the user data.

View Variables

function init()
Invoked automatically when an instance is created.
function indexAction()
The user administration landing page.
function editAction()
The page for administrators to edit users.
function deleteAction()
Deletes a user.
function testdataAction()
Adds a bunch of test users with random but plausible data.
Close