| User | |
| Author | Jaybill McCarthy |
| License | http://communit.as/docs/license |
| See Also | Cts_Controller_Action_Abstract |
| Instance Methods | |
| init | Invoked automatically when an instance is created. |
| Actions | |
| loginbounce | After a user is logged in, they are redirected to this action. |
| cancel | Allows a user to cancel their account. |
| index | Displays a list of community members and a search form. |
| resetpassword | This is step 2 of 2 in the process a user goes through to reset their password. |
| forgotpassword | This is step 1 of 2 in the process a user goes through to reset their password. |
| postregister | This action is called after a user has filled out the registration form and it has been processed. |
| profile | Displays the public profile of a user. |
| register | Either displays a registration form, or processes the registration form, depending on whether or not the Request is a GET or POST. |
| edit | Either displays an edit form to edit a given user, or processes the edit form, depending on whether or not the Request is a GET or POST. |
| deleteavatar | Allows the currently authenticated user to delete their own avatar. |
| Private or Protected Methods | |
| _getConfirmationUrl | Used in forgotpassword to generate a random secret code for the forgot password email. |
| _checkConfirmationUrl | Used in resetpassword to verify whether the email address and secret code match. |
function init()
Invoked automatically when an instance is created. Initializes the current instance. Also initializes the parent object (calls init() on the parent instance).
| username | The username of the user upon which to act. (optional) |
| full_name_length | The maximum number of characters allowed in a user’s full name. Defaults to 50. |
| username_length | The maximum number of characters allowed in a username. Default to 16. |
function cancelAction()
Allows a user to cancel their account. Either displays an input form or processes the input form depending on whether the HTTP Request is GET or POST. After the cancellation form is processed, the browser is redirected to ‘/auth/logout’ (currently hardcoded).
| delete | This is a sort of boolean value whose possible values are ‘yes’ or anything else. The user is only deleted if the value of del is ‘yes’. |
| param delete_row | Do or do not delete the user’s row from the database. Defaults to true (do delete the row). |
| param username | The username of the user to be deleted. Defaults to the currently logged-in user. |
| pagetitle | The value to be displayed in the browser’s title bar. |
| user | A user object for the user to be deleted. |
function indexAction()
Displays a list of community members and a search form.
| gender | For searching/filtering by gender. |
| max_age | For searching/filtering by a maximum age selection. |
| min_age | For searching/filtering by a minimum age selection. |
| page | The index of the current page. |
| region | For searching/filtering by region. |
| searchterm | For searching/filtering by keyword. Database fields searched: username, full_name, and tags. |
| sortby | For changing the sort order of search results. Possible values: ‘updated’, ‘newest’, and ‘login’. Default is ‘newest’. |
| users_per_page | The number of users to show on each page. Default is 30. |
| param users | The array of users to be displayed. |
| param whereclauses | An array of where clauses that will be passed to the search |
| param params | a key/value array of search terms that came in on the request. |
| ages | An array of ages (integers) from 13 to 70 (currently hardcoded). |
| countries | An array of countries pulled from the database. |
| genders | An array of key-value pairs consisting of a formal and informal names (currently hardcoded) for each gender and an ‘any’ option. |
| pagetitle | The HTML page title. |
| params | All params in the param arrays for filters get turned into view variables automatically. |
| regions | An array of regions, typically consisting of continents (currently hardcoded). |
| signs | An array of astrological star signs generated with Cts_Common::GetSignArray. |
| users | An array of users to display as a list of links. |
function resetpasswordAction()
This is step 2 of 2 in the process a user goes through to reset their password. Either displays an input form, or processes the form. The only way to get to this page should be from a link in an automatically-generated email sent to the user (done in the forgotpassword action). The _checkConfirmationUrl method is used to check if the incoming email address and secret code comprise a valid password reset request. If there is an active authenticated session, the browser is redirected to ‘/user/edit’ (currently hardcoded). Upon successfully resetting the password, the browser is redirected to ‘/user/postregister’ (currently hardcoded).
| code | The randomly generated secret code contained in the email. |
| The email address of the user trying to reset their password. |
| code | The randomly generated secret code contained in the email. |
| confirm | The new password a second time. |
| ctaspassword | The new password. |
| The email address of the user trying to reset their password. |
| $code | The randomly generated secret code contained in the email. |
| The email address of the user trying to reset their password. |
function forgotpasswordAction()
This is step 1 of 2 in the process a user goes through to reset their password. Either displays an input form, or processes the form, depending on whether the HTTP Request is GET or POST. Uses _getConfirmationUrl to build a return URL for the email complete with a random secret code. If there is an active authenticated session, the browser is redirected to the logged-in user’s profile (currently hardcoded).
| username | The username of the user trying to reset their password. |
| The email address of the user trying to reset their password. |
| The user’s email address. Only sent to the view if there are errors. | |
| $errors | An array of error messages. Only sent to the view if there are errors. |
| $pagetitle | The HTML title for the page. |
| $showForm | A boolean to determine whether to show the input form or not. |
| $success | A string containing a message to display upon success (currently hardcoded). |
| $username | The user’s username. Only sent to the view if there are errors. |
function postregisterAction()
This action is called after a user has filled out the registration form and it has been processed. It’s useful for changing the redirect action or tweaking session values.
| param redirect_url | The desired redirect URL. |
| param session | The session object for the currently authenticated user session. |
function profileAction()
Displays the public profile of a user. Uses the _user local variable set up in init. If the username is invalid, the browser is redirected to ‘/auth/missing’ (currently hardcoded).
| param user | The user object for the specified user |
| param request | The current HTTP Request (as a Zend_Request). |
| $params | All params in the param arrays for filters get turned into view variables automatically. |
function registerAction()
Either displays a registration form, or processes the registration form, depending on whether or not the Request is a GET or POST. If there is an active authenticated session, the browser is redirected to the authenticated user’s profile (currently hardcoded). After a successful registration, the browser is redirected to ‘/user/postregister’ (currently hardcoded).
| username | The desired username of the registering user. |
| The email address of the registering user. | |
| password | The desired password of the registering user. |
| confirm | The confirmation of the desired password of the registering user. |
| Birthday_Day | The day of the registering user’s birth date. |
| Birthday_Month | The month of the registering user’s birth date. |
| Birthday_Year | The year of the registering user’s birth date. |
| param request | The current HTTP Request (as a Zend_Request). |
| param user | The user object for the registering user. |
| param errors | An array of errors that will be displayed if not empty. |
| param username | The username of the just-registered user. |
| $errors | An array of errors. Only sent if errors are present. |
| $pagetitle | The HTML page title. |
| $user | A user object for a successfully registered user. |
function editAction()
Either displays an edit form to edit a given user, or processes the edit form, depending on whether or not the Request is a GET or POST. If the username passed in does not match the currently authenticated user, the browser is redirected to ‘/auth/missing’ (currently hardcoded).
| param user | The user object for the username in the GET Request parameters. |
| param request | The entire Request object. |
| param session | The entire Session object. |
| param request | The current HTTP Request (as a Zend_Request). |
| param user | The user object for the user being edited. |
| param errors | An array of errors that will be displayed if not empty. |
| param username | The username of the user being edited. |
| $countries | An array of countries pulled from the database. |
| $end_year | TBD |
| $genders | An array of genders. |
| $params | All params in the param arrays for filters get turned into view variables automatically. |
function deleteavatarAction()
Allows the currently authenticated user to delete their own avatar. If the username passed as a parameter doesn’t match the currently authenticated user, the browser is redirected to ‘/auth/missing’ (currently hardcoded). After deleting the avatar image file, the user’s image cache is cleared so the image does not persist. Whether successful or not, the browser is redirected to the referring page.
protected function _getConfirmationUrl( $email, $url = "/user/resetpassword/email/" )
Used in forgotpassword to generate a random secret code for the forgot password email. MD5 encryption is used.
| The email address for which to create a secret validation code. | |
| $url | The URL to link to from the email. |
| salt | A secret number used to aid in encryption and decryption. Default is a randomly generated number. |
| site_url | The URL of the website. Default is ‘http://localhost’. |
A string containing just the newly generated secret code.
protected function _checkConfirmationUrl( $email, $code )
Used in resetpassword to verify whether the email address and secret code match. MD5 decryption is used.
| The email address to validate. | |
| $code | The secret code to validate. |
| salt | A secret number used to aid in encryption and decryption. |
A boolean (true or false).
Invoked automatically when an instance is created.
function init()
After a user is logged in, they are redirected to this action.
function loginbounceAction()
Allows a user to cancel their account.
function cancelAction()
Displays a list of community members and a search form.
function indexAction()
This is step 2 of 2 in the process a user goes through to reset their password.
function resetpasswordAction()
This is step 1 of 2 in the process a user goes through to reset their password.
function forgotpasswordAction()
This action is called after a user has filled out the registration form and it has been processed.
function postregisterAction()
Displays the public profile of a user.
function profileAction()
Either displays a registration form, or processes the registration form, depending on whether or not the Request is a GET or POST.
function registerAction()
Either displays an edit form to edit a given user, or processes the edit form, depending on whether or not the Request is a GET or POST.
function editAction()
Allows the currently authenticated user to delete their own avatar.
function deleteavatarAction()
Used in forgotpassword to generate a random secret code for the forgot password email.
protected function _getConfirmationUrl( $email, $url = "/user/resetpassword/email/" )
Used in resetpassword to verify whether the email address and secret code match.
protected function _checkConfirmationUrl( $email, $code )