PHP Class Carbon_Fields\Container\User_Meta_Container

Inheritance: extends Container
Show file Open project: htmlburger/carbon-fields

Public Properties

Property Type Description
$settings

Protected Properties

Property Type Description
$user_id

Public Methods

Method Description
__construct ( string $title ) Create a new user meta container
attach ( ) Add the container to the user
init ( ) Bind attach() and save() to the appropriate WordPress actions.
is_profile_page ( ) Whether we're on the user profile page
is_valid_attach ( ) : boolean Perform checks whether the container should be attached during the current request
is_valid_save ( $user_id ) : boolean Checks whether the current request is valid
is_valid_save_conditions ( integer $user_id ) : boolean Perform checks whether the current save() request is valid
render ( $user_profile = null ) Output the container markup
save ( integer $user_id ) Perform save operation after successful is_valid_save() check.
set_user_id ( integer $user_id ) Set the user ID the container will operate with.
show_on_user_role ( string $role ) : object Show the container only on users who have the $role role.

Method Details

__construct() public method

Create a new user meta container
public __construct ( string $title )
$title string Unique title of the container

attach() public method

Add the container to the user
public attach ( )

init() public method

Bind attach() and save() to the appropriate WordPress actions.
public init ( )

is_profile_page() public method

Whether we're on the user profile page
public is_profile_page ( )

is_valid_attach() public method

Perform checks whether the container should be attached during the current request
public is_valid_attach ( ) : boolean
return boolean True if the container is allowed to be attached

is_valid_save() public method

Checks whether the current request is valid
public is_valid_save ( $user_id ) : boolean
return boolean

is_valid_save_conditions() public method

Perform checks whether the current save() request is valid
public is_valid_save_conditions ( integer $user_id ) : boolean
$user_id integer ID of the user against which save() is ran
return boolean

render() public method

Output the container markup
public render ( $user_profile = null )

save() public method

The call is propagated to all fields in the container.
public save ( integer $user_id )
$user_id integer ID of the user against which save() is ran

set_user_id() public method

Set the user ID the container will operate with.
public set_user_id ( integer $user_id )
$user_id integer

show_on_user_role() public method

Show the container only on users who have the $role role.
public show_on_user_role ( string $role ) : object
$role string
return object $this

Property Details

$settings public property

public $settings

$user_id protected property

protected $user_id