PHP 클래스 WPDKUser

## Overview In the WPDKUser class you find all method and properties loose in standard WordPress WP_User class.
저자: =undo= ([email protected])
상속: extends WP_User
파일 보기 프로젝트 열기: wpxtreme/wpdk 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$display_name string Replcement of $user->data->display_name
$email string Replcement of $user->data->user_email
$first_name string The user first name. Same $user->get( 'first_name' )
$full_name string Compose first name and last name
$last_name string The user last name. Same $user->get( 'last_name' )
$nice_name string The user nice name
$status string WPDK Extension for status
$statusDescription string WPDK Extension for status description
$user_login string WordPress user login.

공개 메소드들

메소드 설명
__construct ( integer | object | array | string $user, string $name = '', integer | string $blog_id = '' ) : WPDKUser Create an instance of WPDKUser class
age ( string $birthday ) : integer Return the age (in year) from a date in format YYYY-MM-DD or DD/MM/YYYY
allCapabilities ( ) : array Restituisce la lista di tutte le capabilities attualmente presenti in WordPress, scorrendo tutti i ruoli presenti ed estraendo le capabilities.
avatar ( integer $size = 40 ) : WPDKHTMLTagImg | boolean This method is an alias of WPDKUsers::avatar(). Return on instance of WPDKHTMLTagImg class, FALSE otherwise.
create ( string $first_name, string $last_name, string $email, boolean | string $password = false, boolean $enabled = false, string $role = 'subscriber' ) : integer | WP_Error This method is an alias of WPDKUsers::create()
current_user ( ) : WPDKUser Return an instance of WPDKUser class for the current user logged in or null if no user found/logged in
deleteTransient ( string $transient ) : boolean Delete a user transient for this WPDKUser object instance. Return TRUE if successful, FALSE otherwise
deleteTransientWithUser ( string $transient, integer $user_id = null ) : boolean Delete a user transient. Return TRUE if successful, FALSE otherwise
full_name ( string $firstName, string $lastName, boolean $nameFirst = true ) : string Return a full name by first and last name.
getTransient ( string $transient ) : mixed Get the value of transient for this WPDKUser object instance.
getTransientTime ( string $transient ) : integer Return the transient user time
getTransientTimeWithUser ( string $transient, integer $user_id = null ) : integer Return the transient user time
getTransientWithUser ( string $transient, integer $user_id = null ) : mixed Get the value of a user transient.
gravatar ( integer $size = 40, string $alt = '', string $default = "wavatar" ) : string This method is an alias of WPDKUsers::gravatar(). Return the HTML markup for tag img. False otherwise.
hasCap ( string $cap, integer $id_user = null ) : boolean Restutuisce true se l'utente passato negli inputs (o l'utente corrente se non viene passato id utente) possiede un determinato permesso (capability)
hasCaps ( string | array $caps ) : boolean Return TRUE if the user has one or more capabilities.
hasRoles ( string | array $roles ) : boolean Return TRUE if the current user has one o more roles.
nice_name ( string $firstName, string $lastName ) : string Return a nice name by vompose the first letter of first name and append last name, Eg. John Gold -> J.Gold.
roleNameForUserID ( integer $id_user ) : boolean | string Return the role name of a user
setTransient ( string $transient, mixed $value, integer $expiration ) : boolean Set/update the value of transient for this WPDKUser object instance.
setTransientWithUser ( string $transient, mixed $value, integer $expiration, integer $user_id = null ) : boolean Set/update the value of a user transient.
set_role ( string $role ) Set the role of the user. Perform a cache clear for this user.
updateUserCapabilities ( integer $id_user, array $selected_caps, array $capabilities ) Aggiunge e/o rimuove i permessi (capability) da un utente. L'aggiunta avviene eseguendo una match tra una lista di capability selezionate e una lista di confronto, che corrisponde in pratica alle capabilities che possono essere aggiunte. Senza il parametro $capabilities verrebbero prese in considerazione tutte le capabilities, cosa che ovviamente non va bene. In pratica questo metodo dice; in base a questa lista ($capabilities) quali tra quelle selezionate ($selected_caps) devo attivate/disattivare ?

메소드 상세

__construct() 공개 메소드

Create an instance of WPDKUser class
public __construct ( integer | object | array | string $user, string $name = '', integer | string $blog_id = '' ) : WPDKUser
$user integer | object | array | string Optional. User's ID, WP_User object, WPDKUser object, array. If 0 (zero) the current user is get
$name string Optional. User's username
$blog_id integer | string Optional. Blog ID, defaults to current blog.
리턴 WPDKUser

age() 공개 메소드

Return the age (in year) from a date in format YYYY-MM-DD or DD/MM/YYYY
public age ( string $birthday ) : integer
$birthday string Birth of date. MySQL YYYY-MM-DD o in formato data unico vincolo per adesso è il supporto solo per data italiana, ovvero giorno/meso/anno
리턴 integer Age

allCapabilities() 공개 정적인 메소드

Restituisce la lista di tutte le capabilities attualmente presenti in WordPress, scorrendo tutti i ruoli presenti ed estraendo le capabilities.
사용 중단:
public static allCapabilities ( ) : array
리턴 array

avatar() 공개 메소드

This method is an alias of WPDKUsers::avatar(). Return on instance of WPDKHTMLTagImg class, FALSE otherwise.
부터: 1.4.8
public avatar ( integer $size = 40 ) : WPDKHTMLTagImg | boolean
$size integer Optional. Gravatar size
리턴 WPDKHTMLTagImg | boolean

create() 공개 메소드

This method is an alias of WPDKUsers::create()
public create ( string $first_name, string $last_name, string $email, boolean | string $password = false, boolean $enabled = false, string $role = 'subscriber' ) : integer | WP_Error
$first_name string First name
$last_name string Last name
$email string Email address
$password boolean | string Optional. Clear password, if set to FALSE a random password is created
$enabled boolean Optional. If TRUE the user is enabled, FALSE to set in pending
$role string Optional. User role, default 'subscriber'
리턴 integer | WP_Error

current_user() 공개 정적인 메소드

Return an instance of WPDKUser class for the current user logged in or null if no user found/logged in
부터: 1.4.21
public static current_user ( ) : WPDKUser
리턴 WPDKUser

deleteTransient() 공개 메소드

Delete a user transient for this WPDKUser object instance. Return TRUE if successful, FALSE otherwise
부터: 1.5.1
public deleteTransient ( string $transient ) : boolean
$transient string Transient name. Expected to not be SQL-escaped.
리턴 boolean

deleteTransientWithUser() 공개 정적인 메소드

Delete a user transient. Return TRUE if successful, FALSE otherwise
부터: 1.5.1
public static deleteTransientWithUser ( string $transient, integer $user_id = null ) : boolean
$transient string Transient name. Expected to not be SQL-escaped.
$user_id integer Optional. User ID. If null the current user id is used instead
리턴 boolean

full_name() 공개 정적인 메소드

Return a full name by first and last name.
public static full_name ( string $firstName, string $lastName, boolean $nameFirst = true ) : string
$firstName string First name.
$lastName string Last name.
$nameFirst boolean Optional. Default to TRUE [firstname lastname]. Set to FALSE to reverse order.
리턴 string

getTransient() 공개 메소드

If the transient does not exist or does not have a value, then the return value will be false.
부터: 1.4.8
public getTransient ( string $transient ) : mixed
$transient string Transient name. Expected to not be SQL-escaped
리턴 mixed Value of transient

getTransientTime() 공개 메소드

Return the transient user time
부터: 1.4.8
public getTransientTime ( string $transient ) : integer
$transient string Transient name. Expected to not be SQL-escaped
리턴 integer

getTransientTimeWithUser() 공개 정적인 메소드

Return the transient user time
부터: 1.4.8
public static getTransientTimeWithUser ( string $transient, integer $user_id = null ) : integer
$transient string Transient name. Expected to not be SQL-escaped
$user_id integer Optional. User ID. If null the current user id is used instead
리턴 integer

getTransientWithUser() 공개 정적인 메소드

If the transient does not exist or does not have a value, then the return value will be false.
부터: 1.4.8
public static getTransientWithUser ( string $transient, integer $user_id = null ) : mixed
$transient string Transient name. Expected to not be SQL-escaped
$user_id integer Optional. User ID. If null the current user id is used instead
리턴 mixed Value of transient

gravatar() 공개 메소드

This method is an alias of WPDKUsers::gravatar(). Return the HTML markup for tag img. False otherwise.
public gravatar ( integer $size = 40, string $alt = '', string $default = "wavatar" ) : string
$size integer Optional. Gravatar size
$alt string Optional. Alternate string for alt attribute
$default string Optional. Gravatar ID for default (not found) gravatar image
리턴 string

hasCap() 공개 정적인 메소드

Restutuisce true se l'utente passato negli inputs (o l'utente corrente se non viene passato id utente) possiede un determinato permesso (capability)
public static hasCap ( string $cap, integer $id_user = null ) : boolean
$cap string Capability ID
$id_user integer Optional. User ID or null for get current user ID
리턴 boolean True se l'utente supporta la capability

hasCaps() 공개 메소드

Return TRUE if the user has one or more capabilities.
public hasCaps ( string | array $caps ) : boolean
$caps string | array Single string capability or array list
리턴 boolean Se almeno uno dei permessi è presente restituisce true, altrimenti false

hasRoles() 공개 메소드

Return TRUE if the current user has one o more roles.
public hasRoles ( string | array $roles ) : boolean
$roles string | array Single string or array list of roles.
리턴 boolean TRUE if user has the role, else FALSE.

nice_name() 공개 정적인 메소드

If the first and last name are empty, return an empty string. If the firstname is empty, return last name and viceversa.
public static nice_name ( string $firstName, string $lastName ) : string
$firstName string First name
$lastName string Last name
리턴 string

roleNameForUserID() 공개 정적인 메소드

Return the role name of a user
public static roleNameForUserID ( integer $id_user ) : boolean | string
$id_user integer User ID
리턴 boolean | string Ruolo utente o FALSE se errore.

setTransient() 공개 메소드

You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
부터: 1.3.0
public setTransient ( string $transient, mixed $value, integer $expiration ) : boolean
$transient string Transient name. Expected to not be SQL-escaped.
$value mixed Transient value. Expected to not be SQL-escaped.
$expiration integer Time until expiration in seconds, default 0
리턴 boolean False if value was not set and true if value was set.

setTransientWithUser() 공개 정적인 메소드

You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
부터: 1.3.0
public static setTransientWithUser ( string $transient, mixed $value, integer $expiration, integer $user_id = null ) : boolean
$transient string Transient name. Expected to not be SQL-escaped.
$value mixed Transient value. Expected to not be SQL-escaped.
$expiration integer Time until expiration in seconds, default 0
$user_id integer Optional. User ID. If null the current user id is used instead
리턴 boolean False if value was not set and true if value was set.

set_role() 공개 메소드

This will remove the previous roles of the user and assign the user the new one. You can set the role to an empty string and it will remove all of the roles from the user.
부터: 1.5.6
public set_role ( string $role )
$role string Role name.

updateUserCapabilities() 공개 정적인 메소드

Aggiunge e/o rimuove i permessi (capability) da un utente. L'aggiunta avviene eseguendo una match tra una lista di capability selezionate e una lista di confronto, che corrisponde in pratica alle capabilities che possono essere aggiunte. Senza il parametro $capabilities verrebbero prese in considerazione tutte le capabilities, cosa che ovviamente non va bene. In pratica questo metodo dice; in base a questa lista ($capabilities) quali tra quelle selezionate ($selected_caps) devo attivate/disattivare ?
public static updateUserCapabilities ( integer $id_user, array $selected_caps, array $capabilities )
$id_user integer ID dell'utente
$selected_caps array Lista delle capability da aggiungere
$capabilities array Lista di confronto per capire quale capability aggiungere e quale rimuovere

프로퍼티 상세

$display_name 공개적으로 프로퍼티

Replcement of $user->data->display_name
public string $display_name
리턴 string

$email 공개적으로 프로퍼티

Replcement of $user->data->user_email
public string $email
리턴 string

$first_name 공개적으로 프로퍼티

The user first name. Same $user->get( 'first_name' )
public string $first_name
리턴 string

$full_name 공개적으로 프로퍼티

Compose first name and last name
public string $full_name
리턴 string

$last_name 공개적으로 프로퍼티

The user last name. Same $user->get( 'last_name' )
public string $last_name
리턴 string

$nice_name 공개적으로 프로퍼티

The user nice name
public string $nice_name
리턴 string

$status 공개적으로 프로퍼티

WPDK Extension for status
public string $status
리턴 string

$statusDescription 공개적으로 프로퍼티

WPDK Extension for status description
public string $statusDescription
리턴 string

$user_login 공개적으로 프로퍼티

WordPress user login.
부터: 1.7.2
public string $user_login
리턴 string