• Skip to primary navigation
  • Skip to main content

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
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Search for "short code"

Search Results for: short code

WP-Members 3.4.9

Chad Butler · Dec 28, 2023 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

The WP-Members 3.4.9 release is mostly a security update, with a couple of additional features and API functions.

Continue Reading →

wpmem_field_sc_meta_keys

Description

Filters the meta keys the [wpmem_field] shortcode can display.

Parameters

$allowed_fields
(array)(required) An array of the allowed meta keys the shortcode can display.

Changelog

  • Introduced in 3.4.9

Source

wpmem_field_sc_meta_keys is located in includes/class-wp-members-shortcodes.php

Display an icon with email link in the User List

Chad Butler · Oct 24, 2023 ·

I chose the basic email icon that is in the WP dashicons, but there are a couple of dashicon alternatives. And certainly, you could modify this code snippet to use any type of image/icon, such as font awesome. I used the WP dashicons because they are already loaded.

Adding the icon itself (without the link) is nothing more than adding the following span tag to the user profile:

<span class="dashicons dashicons-email"></span>

Adding to the user list view can be done with the wpmem_ul_user_rows filter. There is a verbose example below.

add_filter( 'wpmem_ul_user_rows', function( $rows, $list_id ) {
    
    // User ID is a field in the $rows array, get it as $user_id.
    $user_id = $rows['ID'];
    
    // User email will be in the $rows array by its meta key (see WP-Members Fields tab).
    // HOWEVER, it will have a div wrapper, so we'll strip that out first. (I put them
    // in variables to reuse later when we rewrap the field before returnning).
    $user_email = $rows['user_email'];
    $wrapper_start = '<div class="user_email">';
    $wrapper_end = '</div>';
    $raw_email = str_replace( array( $wrapper_start, $wrapper_end ), array( '', '' ), $user_email );
    
    // Get the dashicon.
    $icon = '<span class="dashicons dashicons-email"></span>';
    
    // Linked icon with the email text.
    $email_w_icon = '<a href="mailto:' . $raw_email . '">' . $icon . '</a> ' . $raw_email;
    
    // Put the div tag back.
    $rows['user_email'] = $wrapper_start . $email_w_icon . $wrapper_end;

    // Return the filtered result.
    return $rows;
    
}, 10, 2 );

Restrict a post or a page to a specific user role

Chad Butler · Jun 20, 2023 ·

While the core plugin restricts posts to logged in users, and can also create memberships for other types of restriction, sometimes you may wish to restrict content to a user role.

This custom code snippet can be copy-pasted to wherever you store custom code and will add a list of roles to the WP-Members restriction meta box in the post editor, and then will restrict the content based on those roles.

Note that this functionality is included in the WP-Members Advanced Options extension.

Continue Reading →

Memberships

There are shortcodes in the plugin that allow you to display a user’s memberships as well as displaying a list of content restricted to a specific membership:

  • [wpmem_user_memberships]
  • [wpmem_user_membership_posts]

[wpmem_user_memberships]

This shortcode displays the memberships a user has available. You can use this anywhere a shortcode can be parsed (which depends on your theme or customizations).

By default, the shortcode outputs a heading and a list of memberships available to the user. There are a number of attributes you can use to customize this output. The following is a list of those attributes and their default values, which you can change as needed.

  • “title_before” => “<h2>”
  • “title_after” => “</h2>”
  • “title” => “Memberships”
  • “list_before” => “<ul>”
  • “list_after” => “</ul>”
  • “item_before” => “<li>”
  • “item_after” => “</li>”
  • “date_format” => “default”
  • “no_expire” => “Does not expire”

To display the default list, just invoke the shortcode:

[[wpmem_user_memberships]]

Examples

To change the heading above the list:

[[wpmem_user_memberships title="Your Available Memberships"]]

To remove the heading above the list:

[[wpmem_user_memberships title_before="" title_after="" title=""]]

To display a single membership with no title:

[[wpmem_user_memberships title_before="" title_after="" title="" list_before="" list_after="" item_before="<p>" item_after="</p>"]]

To display a specific expiration date format, use a PHP date format:

[[wpmem_user_memberships date_format="m/d/Y"]]

[wpmem_user_membership_posts]

This displays a list of posts restricted to a membership that the current user has access to. If the user has more than one membership, it will display a list for each.

Attributes:

  • “title_before” => “<h2>”
  • “title_after” => “</h2>”
  • “list_before” => “<ul>”
  • “list_after” => “</ul>”
  • “item_before” => “<li>”
  • “item_after” => “</li>”
  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 10
  • Page 11
  • Page 12
  • Page 13
  • Page 14
  • Interim pages omitted …
  • Page 52
  • Go to Next Page »

Ready to get started?

Join Today!

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

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