This particular shortcode specializes in fetching and displaying user-related information based on specified parameters.
Syntax
{user:field}
field
represents the user metadata field.
Key Arguments
id
Specifies the user ID to fetch data for. Requires Power Shortcodes privileges.{user:field @ID=3}
all
When set, returns all values of the specified metadata field.{user:field @all}
Examples
Email
{user:email}
Retrieves the email of the current user.
User ID
{user:ID}
Retrieves the email of the current user
Display Name
{user:display_name}
Retrieves the name of the current user.
Registration Date
{date:{user:registered} @format='d-m-Y H:i'}
Retrieves the registration date of the current user.
In this case{user:registered}
is used inside the date shortcode to format it.Specifying User ID
{user:login@id=10}
Fetches the login name of the user with ID 10.
User Roles
{for:role
{user:roles}
{get:role}
@sep=', '
}Returns all roles assigned to the current user.
{user:roles}
returns an array so we cycled the terms with the shortcode {for}.
Special Privileges
Some actions and information retrieval, such as accessing certain user metadata (e.g., email
, login
) or specifying a user ID, require the use of Power Shortcodes.
These have elevated privileges to ensure sensitive data is securely handled.