• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Store
    • Cart
    • Checkout
  • Blog
    • Basics [Free]
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Contact
  • Sign In
  • Show Search
Hide Search
Home » Plugins » WP-Members » Documentation » Shortcodes » Field Shortcodes

Field Shortcodes

The field shortcode can be used to display any of the registration fields for a logged in user. The field parameter corresponds to that field’s option name (found in the WP-Members Fields option tab; this is also the usermeta).

The field shortcode can also be used to display data about other users.  This can be passed in an “id” field.  The id must be either the numeric user ID of a specific user or “get” to indicate that the user ID will be passed through a querystring as “uid” (i.e. http://yoursite/your-page/?uid=123)

You can specify a field’s meta key as a shortcode attribute or you can use the attribute field=”meta_key” (where “meta_key” is the meta key for the desired field).

Usage examples:

Display the user’s username:

[wpmem_field user_login]

[wpmem_field field="user_login"]

Display the user’s first name last name:

[wpmem_field first_name] [wpmem_field last_name]

[wpmem_field field="first_name"] [wpmem_field field="last_name"]

Display email for a specific user (ID=123):

[wpmem_field user_email id="123"]

[wpmem_field field="user_email" id="123"]

Display first name/last name for an ID passed through a querystring (uid):

[wpmem_field first_name id="get"] [wpmem_field last_name id="get"]

[wpmem_field field="first_name" id="get"] [wpmem_field field="last_name" id="get"]

Additional Attributes

There are some additional attributes that can be used, primarily for specific field types.

Select (dropdown), Multiple Select, Multiple Checkbox, and Radio Fields:

These fields generally have a different saved (stored) value than what is displayed to the user (such as the case of a dropdown select field).  The shortcode default is to display the “display” value of the field rather than the saved value.  However, in cases where the saved value is needed, you can add the attribute display=raw to the shortcode.  The following example would display the raw/saved value for the field my_dropdown:

[wpmem_field my_dropdown display=raw]

Textarea Fields:

The textarea field type also accepts the display=raw attribute as outlined above.  In the case of a textarea field, this allows the field’s data to be displayed without converting line breaks to the HTML <br> tag.

Image and File Fields:

File field types display a link to the file. Image field types display the image.  If this raw ID value is desired, then the attribute display=raw can be used.

[wpmem_field my_file display=raw] would display the post ID for the file.

A “file” field type will display a link to the file, using the title parameter from the post.

An “image” field type will display a thumbnail of the image.  This can be changed using the “size” attribute.  The value can be the following:

  • thumbnail
  • medium
  • large
  • full
  • width,height

Examples

[wpmem_field my_image size=medium] would display the medium size of the image where “my_image” is the meta key (option name) of the field.

[wpmem_field my_image size="100,200"] would display the image my_image at a size of 100px wide by 200px high.

Date Fields:

The HTML “date” field type will automatically format its output based on the localized date format setting you have in your WordPress General Settings.

If you want to display this field in another format, you can apply the attribute “format” based on PHP date format parameters.

Clickable Links:

Any field that holds content that may be displayed as a link (either a URL or an email address) can be made clickable by applying the “clickable” attribute set to true.  This can be individual field data such as user_email (making the link a mailto: link) or user_url (making the URL clickable), or it can be a text or textarea field type that contains a URL or email address in which case that piece of the content would be made into a clickable link.

Example:

[wpmem_field user_email clickable=true]

A (not fully exhaustive) List of Parameters from the default install:

WP Default Fields:

  • ID
  • user_login
  • user_email
  • user_nicename
  • user_registered
  • user_url
  • first_name
  • last_name
  • aim
  • yim
  • jabber
  • description

WP-Members Default Fields:

In addition to the above list:

  • addr1
  • addr2
  • city
  • thestate
  • zip
  • country
  • phone1
  • tos

Additional Fields:

Any fields that you might add to the plugin’s registration process can be displayed in this same way.  The value you give to the Option Name is the parameter that you would use.  [See Choosing Fields for how to set up custom fields in the plugin registration]

  • Getting Started
  • Recommended WordPress® Settings
  • Plugin Settings
    • Options
    • Fields
    • Dialogs
    • Emails
    • New Feature Settings
  • Managing Content
    • Restricting Posts
    • Restricting Pages
    • Show Excerpts
    • Custom Post Types
  • Managing Users
    • Import Users
    • Export Users
    • Edit Users
    • Search Users
  • Login
  • Registration
    • Choosing Fields
    • Create a Registration Page
    • Moderating Registration
    • Using CAPTCHA
    • Removing Registration Options
  • User Profile
  • Membership Products
    • Membership Properties
    • Membership Levels
  • Menus
    • Individual Menu Items
    • Logged In Menus
    • Login/Logout Menu Link
  • Customizing Emails
    • Email Address
    • Email Content
    • Email Format
    • Email Shortcodes
    • Email Troubleshooting
  • Customizing Forms
    • Create a Custom Stylesheet
    • Using the WordPress Customizer
    • Login Form HTML
    • Registration Form HTML
    • Widget Login Form HTML
  • Translation and Localization
    • Filter untranslated strings
    • Maintain a custom translation file
  • Shortcodes
    • Pages and Forms
    • Login Status
    • User Fields
    • Email
    • Other Shortcodes
  • WP-CLI Commands
  • API Functions
  • Filter Hooks
  • Action Hooks
  • FAQs
    • Email troubleshooting
    • How to add a shortcode
    • How to apply login redirects
    • Why can’t users log in?
    • Why does reCAPTCHA v3 fail?
    • Troubleshooting Really Simple Captcha
    • How can I prevent registration spam?
    • Are files protected?
    • Why do I get a 403 error?
    • How do I use code snippets?
    • My changes aren’t showing up
    • How to hide the “Admin Bar”
    • How to add a forgot password link
    • Password reset doesn’t show any fields
  • Demo Videos
  • How to Request Support
  • Copy Settings for Support

Ready to get started?

Join Today!

© 2022 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Privacy Policy
  • Terms of Service
  • Refund Policy