Actions

J1.5

Difference between revisions of "Plugin/Events/User"

From Joomla! Documentation

< J1.5:Plugin/Events
(5.3.2.2 Parameters)
m (Fixed heading levels)
Line 1: Line 1:
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Plugins]]
 
[[Category:Plugins]]
====5.3 User Events for Plugin System====
+
==5.3 User Events for Plugin System==
  
 
===5.3.1 Overview===
 
===5.3.1 Overview===
Line 21: Line 21:
  
 
===5.3.2 onLoginUser===
 
===5.3.2 onLoginUser===
==5.3.2.1 Description==
+
====5.3.2.1 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.
 
If one plugin returns false, the entire authentication process fails.
 
If one plugin returns false, the entire authentication process fails.
==5.3.2.2 Parameters==
+
====5.3.2.2 Parameters====
 
Two parameters: $user, and $options.
 
Two parameters: $user, and $options.
  
Line 30: Line 30:
 
*Options is an array array(3) { ["remember"]=>  bool, ["return"]=>  string(7), ["entry_url"]=>  string(59)
 
*Options is an array array(3) { ["remember"]=>  bool, ["return"]=>  string(7), ["entry_url"]=>  string(59)
  
==5.3.2.3 Return Value==
+
====5.3.2.3 Return Value====
 
Boolean
 
Boolean
==5.3.2.4 Used in files==
+
====5.3.2.4 Used in files====
 
   *libraries/joomla/application/application.php
 
   *libraries/joomla/application/application.php
 
   *plugins/user/joomla.php
 
   *plugins/user/joomla.php
==5.3.2.5 Examples==
+
====5.3.2.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php
 
    
 
    
  
 
===5.3.3 onLogoutUser===
 
===5.3.3 onLogoutUser===
==5.3.3.1 Description==
+
====5.3.3.1 Description====
 
This event is triggered before the user is logged out of the system. If one plugin
 
This event is triggered before the user is logged out of the system. If one plugin
 
returns false, the global logout fails.
 
returns false, the global logout fails.
==5.3.3.2 Parameters==
+
====5.3.3.2 Parameters====
 
Array of credentials. Structure:\\
 
Array of credentials. Structure:\\
 
['username']\\
 
['username']\\
 
['id']\\
 
['id']\\
==5.3.3.3 Return Value==
+
====5.3.3.3 Return Value====
 
Boolean
 
Boolean
==5.3.3.4 Used in files==
+
====5.3.3.4 Used in files====
 
   *libraries/joomla/application/application.php
 
   *libraries/joomla/application/application.php
 
   *plugins/user/joomla.php
 
   *plugins/user/joomla.php
==5.3.3.5 Examples==
+
====5.3.3.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php
  
 
===5.3.4 onAuthenticate===
 
===5.3.4 onAuthenticate===
==5.3.4.1 Description==
+
====5.3.4.1 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.
==5.3.4.2 Parameters==
+
====5.3.4.2 Parameters====
 
Array of credentials. Structure:\\
 
Array of credentials. Structure:\\
 
['username']\\
 
['username']\\
Line 64: Line 64:
 
Alternative authentication mechanisms can supply additional credentials.
 
Alternative authentication mechanisms can supply additional credentials.
  
==5.3.4.3 Return Value==
+
====5.3.4.3 Return Value====
 
An array of [[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] objects detailing the results of each called plugin, including success or failure.
 
An array of [[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] objects detailing the results of each called plugin, including success or failure.
==5.3.4.4 Used in files==
+
====5.3.4.4 Used in files====
 
   *libraries/joomla/application/user/authentication.php
 
   *libraries/joomla/application/user/authentication.php
 
   *plugins/authentication/gmail.php
 
   *plugins/authentication/gmail.php
 
   *plugins/authentication/joomla.php
 
   *plugins/authentication/joomla.php
 
   *plugins/authentication/ldap.php
 
   *plugins/authentication/ldap.php
==5.3.4.5 Examples==
+
====5.3.4.5 Examples====
 
   *plugins/authentication/example.php
 
   *plugins/authentication/example.php
  
 
===5.3.5 onLoginFailure===
 
===5.3.5 onLoginFailure===
==5.3.5.1 Description==
+
====5.3.5.1 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.
==5.3.5.2 Parameters==
+
====5.3.5.2 Parameters====
 
Two parameters. The credentials array for the user (see onAuthenticate), and the
 
Two parameters. The credentials array for the user (see onAuthenticate), and the
 
[[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] that caused the failure.
 
[[references:joomla.framework:user:jauthenticateresponse|JAuthenticateResponse]] that caused the failure.
==5.3.5.3 Return Value==
+
====5.3.5.3 Return Value====
 
Unknown. The return value appears to be ignored in any case.
 
Unknown. The return value appears to be ignored in any case.
==5.3.5.4 Used in files==
+
====5.3.5.4 Used in files====
 
   *libraries/joomla/application/user/authentication.php
 
   *libraries/joomla/application/user/authentication.php
  
 
===5.3.6 onBeforeStoreUser===
 
===5.3.6 onBeforeStoreUser===
==5.3.6.1 Description==
+
====5.3.6.1 Description====
 
This event is triggered before an update of a user record, or when a new user is about to be stored in the database.
 
This event is triggered before an update of a user record, or when a new user is about to be stored in the database.
  
==5.3.6.2 Parameters==
+
====5.3.6.2 Parameters====
 
Two parameters:
 
Two parameters:
 
   *An associative array of the columns in the user table.
 
   *An associative array of the columns in the user table.
Line 95: Line 95:
 
   *Boolean to identify if this is a new user (insert) or an existing one (update)
 
   *Boolean to identify if this is a new user (insert) or an existing one (update)
  
==5.3.6.3 Return Value==
+
====5.3.6.3 Return Value====
 
None
 
None
==5.3.6.4 Used in files==
+
====5.3.6.4 Used in files====
 
   *libraries/joomla/user/user.php
 
   *libraries/joomla/user/user.php
==5.3.6.5 Examples==
+
====5.3.6.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php
 
===5.3.7 onAfterStoreUser===
 
===5.3.7 onAfterStoreUser===
==5.3.7.1 Description==
+
====5.3.7.1 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.
==5.3.7.2 Parameters==
+
====5.3.7.2 Parameters====
 
Two parameters:
 
Two parameters:
 
   *An associative array of the columns in the user table.
 
   *An associative array of the columns in the user table.
Line 110: Line 110:
 
   *Boolean to identify if the store was successful
 
   *Boolean to identify if the store was successful
 
   *Error message if store failed
 
   *Error message if store failed
==5.3.7.3 Return Value==
+
====5.3.7.3 Return Value====
 
None
 
None
==5.3.7.4 Used in files==
+
====5.3.7.4 Used in files====
 
   *libraries/joomla/user/user.php
 
   *libraries/joomla/user/user.php
==5.3.7.5 Examples==
+
====5.3.7.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php
  
 
===5.3.8 onBeforeDeleteUser===
 
===5.3.8 onBeforeDeleteUser===
==5.3.8.1 Description==
+
====5.3.8.1 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.
==5.3.8.2 Parameters==
+
====5.3.8.2 Parameters====
 
An associative array containing user information. Structure:\\
 
An associative array containing user information. Structure:\\
 
['id']\\
 
['id']\\
==5.3.8.3 Return Value==
+
====5.3.8.3 Return Value====
 
None.
 
None.
==5.3.8.4 Used in files==
+
====5.3.8.4 Used in files====
 
   *libraries/joomla/user/user.php
 
   *libraries/joomla/user/user.php
 
   *plugins/user/joomla.php
 
   *plugins/user/joomla.php
==5.3.8.5 Examples==
+
====5.3.8.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php
  
 
===5.3.9 onAfterDeleteUser===
 
===5.3.9 onAfterDeleteUser===
==5.3.9.1 Description==
+
====5.3.9.1 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.
==5.3.9.2 Parameters==
+
====5.3.9.2 Parameters====
 
Three parameters: user information, delete result, and error result.
 
Three parameters: user information, delete result, and error result.
 
User information is an associative array. Structure:\\
 
User information is an associative array. Structure:\\
Line 140: Line 140:
 
Delete result is boolean true if the delete succeeded or an error message on failure.\\
 
Delete result is boolean true if the delete succeeded or an error message on failure.\\
 
Error result is a [[references:joomla.framework:utilities:jerror|JError]] object detailing the error, if any.
 
Error result is a [[references:joomla.framework:utilities:jerror|JError]] object detailing the error, if any.
==5.3.9.3 Return Value==
+
====5.3.9.3 Return Value====
 
None.
 
None.
==5.3.9.4 Used in files==
+
====5.3.9.4 Used in files====
 
   *libraries/joomla/user/user.php
 
   *libraries/joomla/user/user.php
 
   *plugins/user/joomla.php
 
   *plugins/user/joomla.php
==5.3.9.5 Examples==
+
====5.3.9.5 Examples====
 
   *plugins/user/example.php
 
   *plugins/user/example.php

Revision as of 18:10, 10 July 2009

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

5.3 User Events for Plugin System

5.3.1 Overview

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

5.3.2.1 Description

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

5.3.2.2 Parameters

Two parameters: $user, and $options.

  • User is an array with the data from the row from the users table
  • Options is an array array(3) { ["remember"]=> bool, ["return"]=> string(7), ["entry_url"]=> string(59)

5.3.2.3 Return Value

Boolean

5.3.2.4 Used in files

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

5.3.2.5 Examples

 *plugins/user/example.php
 

5.3.3 onLogoutUser

5.3.3.1 Description

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

5.3.3.2 Parameters

Array of credentials. Structure:\\ ['username']\\ ['id']\\

5.3.3.3 Return Value

Boolean

5.3.3.4 Used in files

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

5.3.3.5 Examples

 *plugins/user/example.php

5.3.4 onAuthenticate

5.3.4.1 Description

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

5.3.4.2 Parameters

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

5.3.4.3 Return Value

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

5.3.4.4 Used in files

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

5.3.4.5 Examples

 *plugins/authentication/example.php

5.3.5 onLoginFailure

5.3.5.1 Description

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

5.3.5.2 Parameters

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

5.3.5.3 Return Value

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

5.3.5.4 Used in files

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

5.3.6 onBeforeStoreUser

5.3.6.1 Description

This event is triggered before an update of a user record, or when a new user is about to be stored in the database.

5.3.6.2 Parameters

Two parameters:

 *An associative array of the columns in the user table.
 *A unique identifier for this user.
 *Boolean to identify if this is a new user (insert) or an existing one (update)

5.3.6.3 Return Value

None

5.3.6.4 Used in files

 *libraries/joomla/user/user.php

5.3.6.5 Examples

 *plugins/user/example.php

5.3.7 onAfterStoreUser

5.3.7.1 Description

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

5.3.7.2 Parameters

Two parameters:

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

5.3.7.3 Return Value

None

5.3.7.4 Used in files

 *libraries/joomla/user/user.php

5.3.7.5 Examples

 *plugins/user/example.php

5.3.8 onBeforeDeleteUser

5.3.8.1 Description

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

5.3.8.2 Parameters

An associative array containing user information. Structure:\\ ['id']\\

5.3.8.3 Return Value

None.

5.3.8.4 Used in files

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

5.3.8.5 Examples

 *plugins/user/example.php

5.3.9 onAfterDeleteUser

5.3.9.1 Description

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

5.3.9.2 Parameters

Three parameters: user information, delete result, and error result. User information is an associative array. Structure:\\ ['id']\\ Delete result is boolean true if the delete succeeded or an error message on failure.\\ Error result is a JError object detailing the error, if any.

5.3.9.3 Return Value

None.

5.3.9.4 Used in files

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

5.3.9.5 Examples

 *plugins/user/example.php