Core Theme Components

LoginRequired

Provides an annotation for controller methods to check for logged in users. If a capability is passed to the constructor, the annotation will also check if the user has the capability.

Status codes ($statusCode) and redirect locations ($next) may also be passed as well.

Tags
Annotation
NamedArgumentConstructor

Table of Contents

$capability  : string
$next  : string
$statusCode  : int
__construct()  : mixed
getCapability()  : string
Returns the WP capability string.
getNext()  : string
Returns a redirect location.
getStatusCode()  : int
validateUser()  : bool
Calls the Wordpress function is_user_logged_in(). If a capability is set, also checks the current user's capability.

Properties

Methods

__construct()

public __construct([string $capability = '' ][, int $statusCode = 403 ][, string $next = '' ]) : mixed
Parameters
$capability : string = ''
$statusCode : int = 403
$next : string = ''
Return values
mixed

getCapability()

Returns the WP capability string.

public getCapability() : string
Return values
string

getNext()

Returns a redirect location.

public getNext() : string
Return values
string

getStatusCode()

public getStatusCode() : int
Return values
int

Search results