Elgg  Version 6.1
Functions
sessions.php File Reference

Go to the source code of this file.

Functions

 elgg_get_session ()
 Gets Elgg's session object. More...
 
 elgg_get_logged_in_user_entity ()
 Return the current logged in user, or null if no user is logged in. More...
 
 elgg_get_logged_in_user_guid ()
 Return the current logged in user by guid. More...
 
 elgg_is_logged_in ()
 Returns whether or not the user is currently logged in. More...
 
 elgg_is_admin_logged_in ()
 Returns whether or not the viewer is currently logged in and an admin user. More...
 
 elgg_set_cookie (\ElggCookie $cookie)
 Set a cookie, but allow plugins to customize it first. More...
 
 elgg_login (\ElggUser $user, bool $persistent=false)
 Log in a user. More...
 
 elgg_logout ()
 Log the current user out. More...
 
 elgg_register_authentication_failure (\ElggUser $user)
 Registers an authentication failure for a user. More...
 
 elgg_reset_authentication_failures (\ElggUser $user)
 Clears all authentication failures for a give user. More...
 
 elgg_is_authentication_failure_limit_reached (\ElggUser $user, int $limit=null, int $lifetime=null)
 Checks if the authentication failure limit has been reached. More...
 
 elgg_get_login_forward_url (\ElggUser $user)
 Determine which URL the user should be forwarded to upon successful login. More...
 

Function Documentation

elgg_get_logged_in_user_entity ( )

Return the current logged in user, or null if no user is logged in.

Returns
|null
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 24 of file sessions.php.

elgg_get_logged_in_user_guid ( )

Return the current logged in user by guid.

See also
elgg_get_logged_in_user_entity()
Returns
int

Definition at line 34 of file sessions.php.

elgg_get_login_forward_url ( \ElggUser  $user)

Determine which URL the user should be forwarded to upon successful login.

Parameters
\ElggUser$userLogged in user
Returns
string url to redirect to
Since
4.3

Definition at line 141 of file sessions.php.

elgg_get_session ( )

Gets Elgg's session object.

Returns
Since
1.9

Definition at line 15 of file sessions.php.

elgg_is_admin_logged_in ( )

Returns whether or not the viewer is currently logged in and an admin user.

Returns
bool

Definition at line 52 of file sessions.php.

elgg_is_authentication_failure_limit_reached ( \ElggUser  $user,
int  $limit = null,
int  $lifetime = null 
)

Checks if the authentication failure limit has been reached.

Parameters
\ElggUser$userUser to check the limit for
int$limit(optional) number of allowed failures
int$lifetime(optional) number of seconds before a failure is considered expired
Returns
bool
Since
4.3

Definition at line 129 of file sessions.php.

elgg_is_logged_in ( )

Returns whether or not the user is currently logged in.

Returns
bool

Definition at line 43 of file sessions.php.

elgg_login ( \ElggUser  $user,
bool  $persistent = false 
)

Log in a user.

Use elgg_pam_authenticate() to authenticate the user.

See also
elgg_pam_authenticate()
Parameters
\ElggUser$userA valid Elgg user object
boolean$persistentShould this be a persistent login?
Returns
void
Exceptions
LoginException
Since
4.3

Definition at line 81 of file sessions.php.

elgg_logout ( )

Log the current user out.

Returns
bool
Since
4.3

Definition at line 91 of file sessions.php.

elgg_register_authentication_failure ( \ElggUser  $user)

Registers an authentication failure for a user.

Parameters
\ElggUser$useruser to log the failure for
Returns
void
Since
4.3

Definition at line 103 of file sessions.php.

elgg_reset_authentication_failures ( \ElggUser  $user)

Clears all authentication failures for a give user.

Parameters
\ElggUser$useruser to clear the failures for
Returns
void
Since
4.3

Definition at line 115 of file sessions.php.

elgg_set_cookie ( \ElggCookie  $cookie)

Set a cookie, but allow plugins to customize it first.

To customize all cookies, register for the 'init:cookie', 'all' event.

Parameters
\ElggCookie$cookieThe cookie that is being set
Returns
bool
Since
1.9

Definition at line 65 of file sessions.php.