WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKUsers Class Reference

Public Member Functions

 logout ()
 Logout an user. More...
 
 wp_authenticate_user ($user)
 WP authenticate hook. More...
 
 wp_login ($user_login, $user=null)
 WP Login hook. More...
 
 wp_login_failed ($user_login)
 WP Login failed hook. More...
 
 signIn ($user, $password, $remember=false)
 Signin. More...
 
 authenticate ($email, $password)
 User Authenticate. More...
 
 wp_logout ()
 WP Logout hook. More...
 
 signout ()
 Do signout. More...
 
 create ($first_name, $last_name, $email, $password=false, $enabled=false, $role= 'subscriber')
 
 show_user_profile ($user)
 WP Show user profile hook. More...
 
 personal_options_update ($id_user)
 Personal options update hook. More...
 
 personal_options ($user)
 Personal options. More...
 
 profile_personal_options ($user)
 Profile personal options. More...
 
 edit_user_profile ($user)
 WP User Profile hook. More...
 
 edit_user_profile_update ($id_user)
 WP Edit user profile update hook. More...
 
 delete_user ($id_user)
 WP Delete user hook. More...
 
 deleted_user ($id_user)
 WP Deleted user hook. More...
 
 user_contactmethods ($contacts)
 WP User contact methods hook. More...
 
 gravatar ($id_user=null, $size=40, $alt= '', $default= 'wavatar')
 Get html img tag from gravatar.com service. More...
 
 avatar ($id_user=null, $size=40)
 WPDKHTMLTagImg. More...
 
 arrayUserForSDF ()
 

Static Public Member Functions

static init ()
 Init the Singleton instance. More...
 
static userWithMetaAndValue ($meta_key, $meta_value)
 Get user with meta key and value. More...
 
static usersWithCaps ($find_caps)
 
static arrayRoles ()
 Return all WordPress roles. More...
 

Detailed Description

The WPDKUsers allow to manage the WordPress users

Overview

This is a singleton class for manage all WordPress users and adding a several extension for control, checking, login and more.

User meta

See the WPDKUserMeta

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2013-02-26
Version
1.2.0

Definition at line 809 of file wpdk-user.php.

Member Function Documentation

static arrayRoles ( )
static

Return all WordPress roles.

Return a key value pairs array with ID => Description of role

Deprecated:
Use WPDKRoles instead
Returns
array

Definition at line 1636 of file wpdk-user.php.

arrayUserForSDF ( )

Restituisce un array in formato SDF con la lista degli utenti, formattata con 'display name (email)'

Deprecated:
Since 1.0.0.b4
Returns
array

Definition at line 1609 of file wpdk-user.php.

authenticate (   $email,
  $password 
)

User Authenticate.

Try to authenticate an user without log-in in the system. This method is very different by signIn(). Return the user ID on success, FALSE otherwise.

Parameters
string$emailThe email address of the user
string$passwordThe user password
Returns
int|bool

Definition at line 1093 of file wpdk-user.php.

avatar (   $id_user = null,
  $size = 40 
)

WPDKHTMLTagImg.

Return an instance of WPDKHTMLTagImg class

Since
1.4.8
Parameters
int$id_userOptional. User ID or null for current user
int$sizeOptional. Avatar size. Default 40
Returns
WPDKHTMLTagImg|bool

Definition at line 1573 of file wpdk-user.php.

create (   $first_name,
  $last_name,
  $email,
  $password = false,
  $enabled = false,
  $role = 'subscriber' 
)

Create a WordPress user and return the user id on success, WP_Error otherwise.

Parameters
string$first_nameFirst name
string$last_nameLast name
string$emailEmail address
bool | string$passwordOptional. Clear password, if set to FALSE a random password is created
bool$enabledOptional. If FALSE the WPDK user status is set to disable. Default FALSE.
string$roleOptional. User role, default 'subscriber'
Returns
int|WP_Error

Definition at line 1164 of file wpdk-user.php.

delete_user (   $id_user)

WP Delete user hook.

The delete_user action/hook can be used to perform additional actions when a user is deleted. For example, you can delete rows from custom tables created by a plugin.

The hook passes one parameter: the user's ID. This hook runs before a user is deleted.

The hook deleted_user (notice the "ed") runs after a user is deleted.

Choose the appropriate hook for your needs. If you need access to user meta or fields from the user table, use delete_user. User's deleted from Network Site installs may not trigger this hook. Be sure to use the wpmu_delete_user hook for those cases.

Parameters
int$id_userUser ID

Definition at line 1433 of file wpdk-user.php.

deleted_user (   $id_user)

WP Deleted user hook.

The deleted_user action/hook can be used to perform additional actions after a user is deleted. For example, you can delete rows from custom tables created by a plugin.

The hook passes one parameter: the user's ID.

This hook runs after a user is deleted. The hook delete_user (delete vs deleted) runs before a user is deleted.

Choose the appropriate hook for your needs. If you need access to user meta or fields from the user table, use delete_user.

User's deleted from Network Site installs may not trigger this hook. Be sure to use the wpmu_delete_user hook for those cases.

Parameters
int$id_userUser ID

Definition at line 1457 of file wpdk-user.php.

edit_user_profile (   $user)

WP User Profile hook.

This hook only triggers when a user is viewing another users profile page (not their own). If you want to apply your hook to ALL profile pages (including the current user) then you also need to use the show_user_profile hook.

Parameters
WP_User$userWordPress user object

Definition at line 1385 of file wpdk-user.php.

edit_user_profile_update (   $id_user)

WP Edit user profile update hook.

This hook only triggers when a user is viewing another user's profile page (not their own). If you want to apply your hook to ALL profile pages (including the current user) then you also need to use the personal_options_update hook.

Parameters
int$id_userUser ID
Returns
bool

Definition at line 1402 of file wpdk-user.php.

gravatar (   $id_user = null,
  $size = 40,
  $alt = '',
  $default = 'wavatar' 
)

Get html img tag from gravatar.com service.

Return the HTML markup of tag img with the user gravatar. FALSE otherwise.

Parameters
int$id_userOptional. User ID or null for current user
int$sizeOptional. Gravatar size. Default 40
string$altOptional. Alternate string for alt attribute. Default user display name.
string$defaultOptional. Gravatar ID for default (not found) gravatar image, Default wavatar
Returns
string|bool

Definition at line 1542 of file wpdk-user.php.

static init ( )
static

Init the Singleton instance.

Return a singleton instance of WPDKUsers class

Returns
WPDKUsers

Definition at line 818 of file wpdk-user.php.

logout ( )

Logout an user.

Force an user logout when disabled or if in GET you pass wpdk_logout

Definition at line 882 of file wpdk-user.php.

personal_options (   $user)

Personal options.

Hooks immediately after the "Show toolbar..." option on profile page (if current user). Any HTML output should take into account that this hook occurs within the "Personal Options" table element.

Parameters
WP_User$userWordPress user object

Definition at line 1349 of file wpdk-user.php.

personal_options_update (   $id_user)

Personal options update hook.

This hook only triggers when a user is viewing their own profile page (not others). If you want to apply your hook to ALL profile pages (including users other than the current one) then you also need to use the edit_user_profile_update hook.

Parameters
int$id_userUser id

Definition at line 1335 of file wpdk-user.php.

profile_personal_options (   $user)

Profile personal options.

Hooks above the "Name" section of profile page. This is typically used for adding new fields to WordPress profile pages. This hook only triggers if a user is viewing their own profile page. There is no equivalent hook at this point for injecting content onto the profile pages of non-current users.

Parameters
WP_User$userWordPress user object

Definition at line 1367 of file wpdk-user.php.

show_user_profile (   $user)

WP Show user profile hook.

This hook only triggers when a user is viewing their own profile page. If you want to apply your hook to ALL profile pages (not just the current user) then you also need to use the edit_user_profile hook.

Parameters
WP_User$userWordPress user object

Definition at line 1225 of file wpdk-user.php.

signIn (   $user,
  $password,
  $remember = false 
)

Signin.

Do a WordPress Sign in and call filters and action

Parameters
string | int$userAny user id, user email or user login
string$passwordPassword
bool$rememberOptional. TRUE for set a cookie for next login
Returns
bool TRUE if success, FALSE for access denied

Definition at line 1033 of file wpdk-user.php.

signout ( )

Do signout.

Perform sign out.

Definition at line 1136 of file wpdk-user.php.

user_contactmethods (   $contacts)

WP User contact methods hook.

Not used yet because can't get a clean list of $contancts. Then is not possible to display a series of checkboxes that indicate the fields not to show. For it, in fact, should I use just this filter or private function / internal _wp_get_user_contactmethods ().

Parameters
array$contacts
Returns
mixed

Definition at line 1474 of file wpdk-user.php.

static usersWithCaps (   $find_caps)
static

Return the users list with a capability

Parameters
string$find_capsSingle capability
Returns
array

Definition at line 1512 of file wpdk-user.php.

static userWithMetaAndValue (   $meta_key,
  $meta_value 
)
static

Get user with meta key and value.

Return the User id with meta key and meta value.

Parameters
string$meta_keyMeta Key
string$meta_valueMeta value
Returns
int User ID or FALSE

Definition at line 1490 of file wpdk-user.php.

wp_authenticate_user (   $user)

WP authenticate hook.

Called when an user is authenticate.

Parameters
WP_User$userWP_User object
Returns
WP_Error|WP_User

Definition at line 928 of file wpdk-user.php.

wp_login (   $user_login,
  $user = null 
)

WP Login hook.

This method is called when an user signin with homonymous WordPress action wp_login.

Parameters
string$user_loginUser login
WP_User$userOptional.

Definition at line 961 of file wpdk-user.php.

wp_login_failed (   $user_login)

WP Login failed hook.

This method is called when an user wrong signin with homonymous WordPress action wp_login_failed.

Parameters
string$user_loginUser login
Returns
bool

Definition at line 988 of file wpdk-user.php.

wp_logout ( )

WP Logout hook.

This method is called when an user signout with homonymous WordPress action wp_logout.

Definition at line 1119 of file wpdk-user.php.


The documentation for this class was generated from the following file: