Actions

J1.5

Difference between revisions of "Plugin/Events/User"

From Joomla! Documentation

< J1.5:Plugin/Events
m (moved TOC to the right for more convenient page display)
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
In a standard installation of Joomla! 1.5 we have several predefined events which, when triggered, call functions in the associated plugins.
+
{{Warning|This page is under migrating to Joomla 2.5 new plugin trigger methods}}
 +
 
 +
In a standard installation of Joomla! 2.5 we have several predefined events which, when triggered, call functions in the associated plugins.
  
 
The user events are divided into two parts. First we have the events used while  
 
The user events are divided into two parts. First we have the events used while  
 
authentication of a user takes place:
 
authentication of a user takes place:
*onLoginUser
+
*onUserLogin (on Joomla 1.5: onLoginUser)
*onLogoutUser
+
*onUserLogout (on Joomla 1.5: onLogoutUser)
*onAuthenticate
+
*onUserAuthenticate (on Joomla 1.5: onAuthenticate)
*onAuthenticateFailure
+
*onUserAuthorisationFailure (on Joomla 1.5: onAuthenticateFailure)
 
    
 
    
 
Second we have the events triggered during user management:
 
Second we have the events triggered during user management:
*onBeforeStoreUser
+
*onUserBeforeSave (on Joomla 1.5: onBeforeStoreUser)
*onAfterStoreUser
+
*onUserAfterSave (on Joomla 1.5: onAfterStoreUser)
*onBeforeDeleteUser
+
*onUserBeforeDelete (on Joomla 1.5: onBeforeDeleteUser)
*onAfterDeleteUser
+
*onUserAfterDelete (on Joomla 1.5: onAfterDeleteUser)
  
==onLoginUser==
+
==onUserLogin==
 
===Description===
 
===Description===
 
This event is triggered after the user is authenticated against the Joomla! user-base.
 
This event is triggered after the user is authenticated against the Joomla! user-base.
Line 34: Line 36:
 
*<tt>plugins/user/example.php</tt>
 
*<tt>plugins/user/example.php</tt>
  
==onLogoutUser==
+
==onUserLogout==
 
===Description===
 
===Description===
 
This event is triggered before the user is logged out of the system. <del>If one plugin
 
This event is triggered before the user is logged out of the system. <del>If one plugin
Line 51: Line 53:
 
*<tt>plugins/user/example.php</tt>
 
*<tt>plugins/user/example.php</tt>
  
==onAuthenticate==
+
==onUserAuthenticate==
 
===Description===
 
===Description===
 
This event is triggered to verify that a set of login credentials is valid.
 
This event is triggered to verify that a set of login credentials is valid.
Line 70: Line 72:
 
*<tt>plugins/authentication/example.php</tt>
 
*<tt>plugins/authentication/example.php</tt>
  
==onLoginFailure==
+
==onUserLoginFailure==
 
===Description===
 
===Description===
 
This event is triggered whenever a user authentication request is failed by any plugin.
 
This event is triggered whenever a user authentication request is failed by any plugin.
Line 81: Line 83:
 
*<tt>libraries/joomla/application/user/authentication.php</tt>
 
*<tt>libraries/joomla/application/user/authentication.php</tt>
  
==onBeforeStoreUser==
+
==onUserBeforeSave==
 
===Description===
 
===Description===
 
This event is triggered before an update of a user record.
 
This event is triggered before an update of a user record.
Line 99: Line 101:
 
*<tt>plugins/user/example.php</tt>
 
*<tt>plugins/user/example.php</tt>
  
==onAfterStoreUser==
+
==onUserAfterSave==
 
===Description===
 
===Description===
 
This event is triggered after an update of a user record, or when a new user has been stored in the database.
 
This event is triggered after an update of a user record, or when a new user has been stored in the database.
Line 119: Line 121:
 
*<tt>plugins/user/example.php</tt>
 
*<tt>plugins/user/example.php</tt>
  
==onBeforeDeleteUser==
+
==onUserBeforeDelete==
 
===Description===
 
===Description===
 
The event is triggered when a user is about to be deleted from the system.
 
The event is triggered when a user is about to be deleted from the system.
Line 133: Line 135:
 
*<tt>plugins/user/example.php</tt>
 
*<tt>plugins/user/example.php</tt>
  
==onAfterDeleteUser==
+
==onUserAfterDelete==
 
===Description===
 
===Description===
 
The event is triggered after a user has been deleted from the system.
 
The event is triggered after a user has been deleted from the system.

Revision as of 09:49, 26 November 2012

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Stop hand nuvola.svg.png
Warning!

This page is under migrating to Joomla 2.5 new plugin trigger methods


In a standard installation of Joomla! 2.5 we have several predefined events which, when triggered, call functions in the associated plugins.

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

  • onUserLogin (on Joomla 1.5: onLoginUser)
  • onUserLogout (on Joomla 1.5: onLogoutUser)
  • onUserAuthenticate (on Joomla 1.5: onAuthenticate)
  • onUserAuthorisationFailure (on Joomla 1.5: onAuthenticateFailure)

Second we have the events triggered during user management:

  • onUserBeforeSave (on Joomla 1.5: onBeforeStoreUser)
  • onUserAfterSave (on Joomla 1.5: onAfterStoreUser)
  • onUserBeforeDelete (on Joomla 1.5: onBeforeDeleteUser)
  • onUserAfterDelete (on Joomla 1.5: onAfterDeleteUser)

onUserLogin

Description

This event is triggered after the user is authenticated against the Joomla! user-base.

If you need to abort the login process (authentication), you will need to use onAuthenticate instead.

Parameters

  • $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

Return Value

Boolean

Used in files

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

Examples

  • plugins/user/example.php

onUserLogout

Description

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

Parameters

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

Return Value

Boolean

Used in files

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

Examples

  • plugins/user/example.php

onUserAuthenticate

Description

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

Parameters

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

Return Value

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

Used in files

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

Examples

  • plugins/authentication/example.php

onUserLoginFailure

Description

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

Parameters

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

Return Value

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

Used in files

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

onUserBeforeSave

Description

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'].

Parameters

  • $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();

Return Value

None

Used in files

  • libraries/joomla/user/user.php

Examples

  • plugins/user/example.php

onUserAfterSave

Description

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'].

Parameters

  • $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 were just updated are not available here or afterwards. In case you need the old values, use onBeforeStoreUser().

Return Value

None

Used in files

  • libraries/joomla/user/user.php

Examples

  • plugins/user/example.php

onUserBeforeDelete

Description

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

Parameters

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

Return Value

None.

Used in files

  • libraries/joomla/user/user.php
  • plugins/user/joomla.php

Examples

  • plugins/user/example.php

onUserAfterDelete

Description

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

Parameters

  • $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)

Return Value

None.

Used in files

  • libraries/joomla/user/user.php
  • plugins/user/joomla.php

Examples

  • plugins/user/example.php