Directory | Profile | File-type Fields | Embedded Content | Installation and Setup | Customizations and Styling | Action and Filter Hooks | Shortcode Examples | Screenshots


How It Works

This plugin creates 2 shortcodes for Member Directory and Member Profile pages, which when added to the body of their respective pages will create a new way to view your community’s members.

The Member Directory page lists all of your members with some profile information, an avatar and a link to their Member Profile page(read-only), Member Profile page highlights each member individually but also links to Member Directory page.

You can create the pages manually and add the shortcodes, or you can let the plugin do it for you! To generate your new pages, select Memberships > Page Settings in the WordPress admin area. Shortcode attributes make it easy to update the display of your directory and member profiles, include members by level ID, and display custom user profile information.


Video Demo


pmpro_member-directoryThe Member Directory

A directory can be inserted in any page or post via a Block or Shortcode ([pmpro_member_directory]). The following settings and attributes are available:

  • avatar_size: The square pixel dimensions of the avatar to display. Requires the “show_avatar” attribute to be set to ‘true’. default: ‘128’ (accepts any numerical value).
  • fields: Display additional user meta fields. default: none (accepts a list of label names and field IDs, i.e. fields="Company,company;Website,user_url").
  • layout: The format of the directory. default: div (accepts ‘table’, ‘div’, ‘2col’, ‘3col’, and ‘4col’).
  • levels: The level ID or a comma-separated list of level IDs to include in the directory. default: all levels (accepts a single level ID or a comma-separated list of IDs).
  • limit: the number of members to display per page
  • link: Optionally link the member directory item to the single member profile page. default: true (accepts ‘true’ or ‘false’).
  • order: Sort the results based on the order_by attribute in ascending or descending order. default: ASC (accepts ‘DESC’ or ‘ASC’).
  • order_by: The sort order for the results. default: ‘u.display_name’ (accepts ‘u.user_email’, ‘u.user_email’, ‘u.display_name’, ‘u.user_login’, ‘u.user_registered’, ‘mu.membership_id’, ‘mu.startdate’, ‘joindate’)
  • show_avatar: Display the user’s avatar generated via Gravatar or user-submitted using a plugin like Simple Local Avatars; default: true (accepts ‘true’ or ‘false’).
  • show_email: Display the user’s email address; default: true (accepts ‘true’ or ‘false’).
  • show_level: Display the user’s membership level; default: true (accepts ‘true’ or ‘false’).
  • show_search: Display a search form (searches on member display name or email address); default: true (accepts ‘true’ or ‘false’).
  • show_startdate: Display the user’s membership start date for their current level; default: true (accepts ‘true’ or ‘false’).

We have a list of shortcode examples at the bottom of this documentation page if you are using this method.


pmpro_member-profileThe Member Profile

A profile can be inserted in any page or post via a Block or Shortcode ([pmpro_member_profile]). The following settings and attributes are available:

  • avatar_size: The square pixel dimensions of the avatar to display. Requires the “show_avatar” attribute to be set to ‘true’. default: ‘128’ (accepts any numerical value).
  • fields: Display additional user meta fields. default: none (accepts a list of label names and field IDs, i.e. fields="Company,company;Website,user_url").
  • levels: The level ID or a comma-separated list of level IDs that allow profiles. default: all levels (accepts a single level ID or a comma-separated list of IDs).
  • show_avatar: Display the user’s avatar generated via Gravatar or user-submitted using a plugin like Simple Local Avatars; default: true (accepts ‘true’ or ‘false’).
  • show_bio: Display the user’s bio (if available); default: true (accepts ‘true’ or ‘false’).
  • show_billing: Display the user’s billing address (if available); default: true (accepts ‘true’ or ‘false’).
  • show_email: Display the user’s email address; default: true (accepts ‘true’ or ‘false’).
  • show_name: Display the user’s display name; default: true (accepts ‘true’ or ‘false’). Use our Force First Last plugin to batch update display names.
  • show_level: Display the user’s membership level; default: true (accepts ‘true’ or ‘false’).
  • show_phone: Display the user’s billing phone (if available); default: true (accepts ‘true’ or ‘false’).
  • show_search: Display a search form (searches on member display name or email address); default: true (accepts ‘true’ or ‘false’).
  • show_startdate: Display the user’s membership start date for their current level; default: true (accepts ‘true’ or ‘false’).
  • user_id: Show a specific member’s profile; default: none (accepts any numeric uesr id, i.e. user_id=”125″).

Members can opt out of the member directory by checking the “Hide from Directory?” field on the “Edit Profile” page.

We have a list of shortcode examples at the bottom of this documentation page if you are using this method.


Notes about File-type Fields

If you are displaying a field that is a file type (audio, video, image, document), the shortcode will attempt to embed or display the file based on the mime type (about WordPress filetypes).

  • Audio files will embed using the WordPress [audio] shortcode
  • Document files will display the appropriate wp_mime_type_icon and a link to view or download the file
  • Image files will display as a standard image on the page at full size
  • Video files will embed using the WordPress [video] shortcode

Notes about other Third-Party embeddable links (YouTube, Vimeo, etc.)

The field will also display as an embed (list of supported sites here) if the field value can be embedded via oEmbed (about WordPress oEmbeds).


Installation

  1. Members with a valid PMPro Plus license can install and activate this add on via the Memberships > Add Ons admin page. Or, download the zip file (above) and upload the ‘pmpro-member-directory’ directory to the ‘/wp-content/plugins/’ directory of your site.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Create a page for your directory and configure the Membership Directory Block or [pmpro_member_directory] shortcode. Set the appropriate levels to “Require Membership” to view the Directory.
  4. Create a page for your profile and configure the Membership Profile Block or [pmpro_member_profile] shortcode. Set the appropriate levels to “Require Membership” to view Profiles.
  5. Navigate to Memberships > Page Settings to assign your pages to the Directory and Profile page settings.

Customizations, Theme Compatibility, and Styling

The screenshots in these docs use the Memberlite Theme, which provides full integration and additional styling for the Member Directory and Profile Pages Add On.

Theme authors and developers can create a custom template for the Directory and Profile via two methods: a template in the active theme folder or a template loaded via a customization plugin.

Theme authors should use the theme method as outlined in this document. The files directory.php and profile.php should copied out of the Add On plugin files and placed in a new /paid-memberships-pro/pmpro-member-directory/ folder in your theme.

If you are not a theme author looking to build support for this Add On, we recommend using the customization plugin method to load your custom template as outlined in this document.


Action and Filter Hooks

The following actions and filters are available in this Add On:

apply_filters( 'pmpromd_profile_url', string $profile_url );
apply_filters( 'pmpro_member_profile_fields', array $fields_array, user $pu );
apply_filters( 'pmpro_member_directory_sql_parts', array $sql_parts, string $levels, string $s, int $pn, int $limit, int $start, int $end, string $order_by, string $order );

The $levels parameter is a single level ID or a comma-separate list of IDs (not an array of level IDs).

The $sql_parts parameter is an array of each section of the SQL query for building your list of members to include in the directory. The sections of the array you can modify include:

  • $sql_parts['SELECT']
  • $sql_parts['JOIN']
  • $sql_parts['WHERE']
  • $sql_parts['GROUP']
  • $sql_parts['ORDER']
  • $sql_parts['LIMIT']

Shortcode Examples

Show only level IDs 1 and 4, hide avatars and email address:

[pmpro_member_directory levels="1,4" show_avatar="false" show_email="false"]

Show all level IDs, hide level name and start date:

[pmpro_member_directory show_level="false" show_startdate="false"]

Show custom user meta fields using the “fields” attribute in the format Label,key;Label,key:

[pmpro_member_directory fields="Company,company;Website,user_url"]

Show a unique member directory by level. Level 1 Members can only see other Level 1 Members…:

[membership level="1"]
[pmpro_member_directory levels="1"]
[/membership]
 
[membership level="2"]
[pmpro_member_directory levels="2"]
[/membership]
 
[membership level="3"]
[pmpro_member_directory levels="3"]
[/membership]

Show unique member profiles based on level – hide user phone number and email address.

[membership level="1"]
[pmpro_member_profile show_email="false" show_phone="false"]
[/membership]
 
[membership level="2"]
[pmpro_member_profile show_email="true" show_phone="true"]
[/membership]

Screenshots

Member Directory – 4 Column Layout
pmpro_member_directory-avatars


Member Directory – Table Layout
pmpro_member-directory-table


Member Profile
pmpro_member-profile


Member Profile with File Embeds
pmpro_member_profile-files