J1.5

Plugin/Events/User

From Joomla! Documentation

< J1.5:Plugin/Events
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "J1.5" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

5.3 User Events for Plugin System[edit]

5.3.1 Overview[edit]

In a standard installation of Joomla! 1.5 we have several predefined events which, when triggered, call functions in the associated plugins. For more information on plugins, look here.

The user events are divided into two parts. First we have the events used while authentication of a user takes place:

 *onLoginUser
 *onLogoutUser
 *onAuthenticate
 *onAuthenticateFailure
 

Second we have the events triggered during user management:

 *onBeforeStoreUser
 *onAfterStoreUser
 *onBeforeDeleteUser
 *onAfterDeleteUser


5.3.2 onLoginUser[edit]

5.3.2.1 Description[edit]

This event is triggered after the user is authenticated against the Joomla! user-base. If one plugin returns false, the entire authentication process fails. (needs verification)

5.3.2.2 Parameters[edit]

 * $user - an associative array of JAuthenticateResponse type (see link for array keys)
 * $options - an associative array containing these keys: ["remember"] => bool, ["return"] => string, ["entry_url"] => string

5.3.2.3 Return Value[edit]

Boolean

5.3.2.4 Used in files[edit]

 *libraries/joomla/application/application.php
 *plugins/user/joomla.php

5.3.2.5 Examples[edit]

 *plugins/user/example.php


5.3.3 onLogoutUser[edit]

5.3.3.1 Description[edit]

This event is triggered before the user is logged out of the system. If one plugin returns false, the global logout fails. (needs verification)

5.3.3.2 Parameters[edit]

 * $credentials - an associative array containing these keys: ["username"] => string, ["id"] => int
 * $options - an associative array containing this key: ["clientid"] => int

5.3.3.3 Return Value[edit]

Boolean

5.3.3.4 Used in files[edit]

 *libraries/joomla/application/application.php
 *plugins/user/joomla.php

5.3.3.5 Examples[edit]

 *plugins/user/example.php


5.3.4 onAuthenticate[edit]

5.3.4.1 Description[edit]

This event is triggered to verify that a set of login credentials is valid.

5.3.4.2 Parameters[edit]

Array of credentials. Structure:\\ ['username']\\ ['password']\\ Alternative authentication mechanisms can supply additional credentials.

5.3.4.3 Return Value[edit]

An array of JAuthenticateResponse objects detailing the results of each called plugin, including success or failure.

5.3.4.4 Used in files[edit]

 *libraries/joomla/application/user/authentication.php
 *plugins/authentication/gmail.php
 *plugins/authentication/joomla.php
 *plugins/authentication/ldap.php

5.3.4.5 Examples[edit]

 *plugins/authentication/example.php


5.3.5 onLoginFailure[edit]

5.3.5.1 Description[edit]

This event is triggered whenever a user authentication request is failed by any plugin.

5.3.5.2 Parameters[edit]

Two parameters. The credentials array for the user (see onAuthenticate), and the JAuthenticateResponse that caused the failure.

5.3.5.3 Return Value[edit]

Unknown. The return value appears to be ignored in any case.

5.3.5.4 Used in files[edit]

 *libraries/joomla/application/user/authentication.php


5.3.6 onBeforeStoreUser[edit]

5.3.6.1 Description[edit]

This event is triggered before an update of a user record.

Password in $user array is already hashed at this point. You may retrieve the cleartext password using $_POST['password'].

5.3.6.2 Parameters[edit]

 * $user - An associative array of the columns in the user table (current values).
 * $isnew - Boolean to identify if this is a new user (true - insert) or an existing one (false - update)

Note; You can retrieve the values that are about to get updated with JFactory::getUser();

5.3.6.3 Return Value[edit]

None

5.3.6.4 Used in files[edit]

 *libraries/joomla/user/user.php

5.3.6.5 Examples[edit]

 *plugins/user/example.php

5.3.7 onAfterStoreUser[edit]

5.3.7.1 Description[edit]

This event is triggered after an update of a user record, or when a new user has been stored in the database.

Password in $user array is already hashed at this point. You may retrieve the cleartext password using $_POST['password'].

5.3.7.2 Parameters[edit]

 * $user - An associative array of the columns in the user table.
 * $isnew - Boolean to identify if this is a new user (true - insert) or an existing one (false - update)
 * $success - Boolean to identify if the store was successful
 * $msg - Error message if store failed

Note; The old values that was just updated, is not available here/afterwards. In that case use onBeforeStoreUser()

5.3.7.3 Return Value[edit]

None

5.3.7.4 Used in files[edit]

 *libraries/joomla/user/user.php

5.3.7.5 Examples[edit]

 *plugins/user/example.php


5.3.8 onBeforeDeleteUser[edit]

5.3.8.1 Description[edit]

The event is triggered when a user is about to be deleted from the system.

5.3.8.2 Parameters[edit]

 * $user - An associative array of the columns in the user table.

5.3.8.3 Return Value[edit]

None.

5.3.8.4 Used in files[edit]

 *libraries/joomla/user/user.php
 *plugins/user/joomla.php

5.3.8.5 Examples[edit]

 *plugins/user/example.php


5.3.9 onAfterDeleteUser[edit]

5.3.9.1 Description[edit]

The event is triggered after a user has been deleted from the system.

5.3.9.2 Parameters[edit]

 * $user - An associative array of the columns in the user table.
 * $succes - Boolean to identify if the deletion was successful
 * $msg - Error message if delete failed (JError object detailing the error, if any)

5.3.9.3 Return Value[edit]

None.

5.3.9.4 Used in files[edit]

 *libraries/joomla/user/user.php
 *plugins/user/joomla.php

5.3.9.5 Examples[edit]

 *plugins/user/example.php