• 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

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>”

wpmem_export_fields

Description

Filters the fields included in export.

Defaults:

The array of export fields is keyed as 'meta_key' => 'heading value'.
The array will include all fields in the Fields tab, plus the following:

@type int    $ID               ID from wp_users
@type string $username         user_login from wp_users
@type string $user_nicename    user_nicename
@type string $user_url         user_url
@type string $display_name     display_name
@type int    $active           Whether the user is active/deactivated.
@type string $exp_type         If the PayPal extension is installed pending|subscrption (optional)
@type string $expires          If the PayPal extension is installed MM/DD/YYYY (optional)
@type string $user_registered  user_registered
@type string $user_ip          The IP of the user when they registered.
@type string $role             The user's role (or roles, if multiple).

Parameters

$export_fields
(array) (required) An array of any fields included in the export.

$tag
(string) (optional) The export being performed, default value: “default“

Changelog

  • Introduced in version 3.2.5
  • 3.4.0 added $tag

Source

wpmem_export_fields is located in includes/class-wp-members-user-export.php

WP-Members 3.4.7

Chad Butler · Apr 3, 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..

 

WP-Members 3.4.7 is now available. This release continues the improvements slated for 3.4 moving the plugin forward towards a smooth transition into 3.5.

This is mostly a code improvement release, along with some additional API functions and a few minor new features.

Remember that the legacy password reset (requiring both username and email) will be fully obsolete in 3.5, so upgrade if you have not already done so.

Continue Reading →
  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 11
  • Page 12
  • Page 13
  • Page 14
  • Page 15
  • Interim pages omitted …
  • Page 54
  • Go to Next Page »

Ready to get started?

Join Today!

© 2026 · 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