User Dynamic Content

In this article we're going to explain how to use User Dynamic Content.

  1. Display Name
  2. Email Address
  3. Gravatar URL
  4. Registration Date
  5. Registration Time
  6. Author URL
  7. Website URL
  8. Biographical Info
  9. Usermeta
  10. ID
  11. Current User Logged In
  12. Roles
  13. Capabilities
  14. All Roles
  15. All Capabilities
  16. Total Count
  17. See Also

Users make up both users that access your site and authors/admins that can create and edit your site. Most User Dynamic Content data points can select either the Current User which would be the currently logged in User (if any), Author which would be the author of the Post or Page, and Specific User which could be any user in your site.

User Display Name Dynamic Content

Display Name

Typically the first name and last name of a user.

Email Address

The email address associated with this user's account, which is used for login and other purposes.

Gravatar URL

The image URL for this users Gravatar which can be set per user by their email.

Registration Date

The date and time when the user first registered their account formatted by the default Date format in WordPress.

Registration Time

The date and time when the user first registered their account formatted by the default Time format in WordPress.

Author URL

Public URL of this user which would display their created posts in an archive.

Website URL

Website associated to this user.

Biographical Info

User data description which is set as a quick about text for a given user.

Usermeta

Much like Post Meta, User Meta allows plugins to create new data points and functionality for a user. It also displays info on their display and editing settings within WordPress.

Protected User Fields

For security reasons, certain sensitive fields are never exposed through User Dynamic Content, regardless of who is rendering the token. Because WordPress reads core columns from the users table before falling back to usermeta, requesting one of these keys (for example {{dc:user:meta key="user_pass" user="1"}}) would otherwise return raw account data such as a password hash. These keys are also hidden from the Usermeta key selector in the UI.

By default the following keys are blocked:

  • user_pass
  • user_activation_key
  • session_tokens

Developers can extend this list with the cs_dynamic_content_protected_user_fields filter to block additional fields or meta keys from being rendered:

add_filter( 'cs_dynamic_content_protected_user_fields', function ( $fields ) { $fields[] = 'my_sensitive_meta_key'; return $fields; } );

The comparison is case-insensitive, so you do not need to account for capitalization variations of a key.

ID

This is a unique identifier for the user and used to reference them in other parts of your site.

Current User Logged In

A true or false return value of whether this current session is a logged in user.

Roles

The roles assigned to the selected user (Current User, Author, or a Specific User). Each role is returned as an item containing its id followed by the role's data, which makes this an ideal source for a Looper when you want to output every role a user holds. Roles that are no longer registered on the site are skipped.

Capabilities

The full list of capabilities granted to the selected user. This is the user's effective set of capabilities, combining those provided by their roles with any granted individually.

All Roles

Every role registered on the site, regardless of the current user. Like Roles, each item begins with its id followed by the role's data, so it can be looped to build a list of all available roles.

All Capabilities

A unique list of every capability provided by any role registered on the site. Use this to enumerate all capabilities available across your site rather than those belonging to a single user.

Total Count

Total number of users in the system. An additional argument of role can be passed to count users by a certain role.

See Also

See something inaccurate? Let us know