For developers requiring advanced customization beyond the template and block settings, the Member Directory Add On offers several action and filter hooks.

Table of contents

Filters

pmpro_member_directory_display_name

Modify the display name for members in your Member Directory and Member Profile.

apply_filters( 'pmpro_member_directory_display_name', $user->display_name, $user );

Parameters

  • $user->display_name: string; The member’s display name.
  • $user: object; The member’s user object.

pmpromd_user_identifier

Filter to change how user identifiers are presented. Choose between slug and ID (case-sensitive).

apply_filters( 'pmpromd_user_identifier', 'slug' );

Parameters

  • $identifier: string; How user identifiers are presented. Accepts slug or ID. Default slug.

pmpromd_profile_url

Dynamically filter the profile URL. Use this filter to optionally link Directory entries to a specific Profile page per user ID or to an external URL.

apply_filters( 'pmpromd_profile_url', get_permalink( $pmpro_pages['profile'] ) );

Parameters

  • $profile_url: string; The profile page URL. Defaults to the permalink of the configured profile page.

pmpro_member_profile_elements

Filter the elements array for the member profile.

apply_filters( 'pmpro_member_profile_elements', $elements_array, $pu );

Parameters

  • $elements_array: array; The array of elements displayed on the member profile.
  • $pu: object; The profile user object.

Filter which links are displayed on the single Member Directory Profile page.

apply_filters( 'pmpromd_member_profile_action_links', $pmpro_member_profile_action_links );

Parameters

  • $pmpro_member_profile_action_links: array; The action links displayed on the single Member Directory Profile page.

pmpromd_get_display_value

Filter the value of a specific element from a string of HTML.

apply_filters( 'pmpromd_get_display_value', $value, $element, $pu, $displayed_levels );

Parameters

  • $value: string; The value of the element as a string of HTML.
  • $element: string; The element key being filtered.
  • $pu: object; The profile user object.
  • $displayed_levels: array; The membership levels being displayed.

pmpro_member_directory_sql_search_where

Allow filtering the member directory search SQL to be used.

apply_filters( 'pmpro_member_directory_sql_search_where', $sql_search_where, $s );

Parameters

  • $sql_search_where: string; The WHERE clause used for the directory search.
  • $s: string; The search term.

pmpro_member_directory_sql_parts

Filter the individual sections of the SQL query used to build your list of members for the directory.

apply_filters( 'pmpro_member_directory_sql_parts', $sql_parts, $levels, $s, $pn, $limit, $start, $end, $order_by, $order );

Parameters

  • $sql_parts: array; Each section of the SQL query for building your list of members. Modifiable sections: $sql_parts['SELECT'], $sql_parts['JOIN'], $sql_parts['WHERE'], $sql_parts['GROUP'], $sql_parts['ORDER'], $sql_parts['LIMIT'].
  • $levels: A single level ID or a comma-separated list of IDs (not an array of level IDs).
  • $s: string; The search term.
  • $pn: int; The current page number.
  • $limit: int; The number of results per page.
  • $start: int; The starting result offset.
  • $end: int; The ending result offset.
  • $order_by: string; The column to order results by.
  • $order: string; The sort direction.

pmpro_member_directory_sql

Allow filtering the final member directory SQL before users are queried.

apply_filters( 'pmpro_member_directory_sql', $sqlQuery, $levels, $s, $pn, $limit, $start, $end, $order_by, $order );

Parameters

  • $sqlQuery: string; The final SQL query before users are queried.
  • $levels: A single level ID or a comma-separated list of IDs (not an array of level IDs).
  • $s: string; The search term.
  • $pn: int; The current page number.
  • $limit: int; The number of results per page.
  • $start: int; The starting result offset.
  • $end: int; The ending result offset.
  • $order_by: string; The column to order results by.
  • $order: string; The sort direction.

pmpromd_user_directory_results

Filter the array of users returned from the query before display.

apply_filters( 'pmpromd_user_directory_results', $theusers );

Parameters

  • $theusers: array; The array of users returned from the query before display.

pmpro_member_directory_elements

Filter the elements array for the member directory.

apply_filters( 'pmpro_member_directory_elements', $elements_array );

Parameters

  • $elements_array: array; The array of elements displayed in the member directory.

pmpromd_map_id

Filter to adjust the unique identifier for the map.

apply_filters( 'pmpromd_map_id', $map_id, $attributes );

Parameters

  • $map_id: string; The unique identifier for the map.
  • $attributes: array; The block/shortcode attributes.

pmpromd_map_failed_to_load_notice

Adjust the notice that is displayed when the map fails to load.

apply_filters( 'pmpromd_map_failed_to_load_notice', $notice );

Parameters

  • $notice: string; The notice displayed when the map fails to load.

pmpromd_default_map_zoom_level

Filter to adjust the default zoom level of the map across all map instances. You can adjust the zoom level per-map by modifying the map_zoom shortcode attribute or block setting.

apply_filters( 'pmpromd_default_map_zoom_level', '8' );

Parameters

  • $zoom_level: string; The default map zoom level applied across all map instances. Default 8.

pmpromd_maps_query_params

Filter to add query parameters or load custom libraries via the Google Maps API request.

apply_filters( 'pmpromd_maps_query_params', $query_params );

Parameters

  • $query_params: array; The query parameters added to the Google Maps API request.

pmpromd_default_map_start

Adjust the map starting point location. This gets automatically overridden when there are markers on the map. Accepts an array of coordinates in the format array( 'lat' => -34.397, 'lng' => 150.644 ).

apply_filters( 'pmpromd_default_map_start', array $default_start, $map_id );

Parameters

  • $default_start: array; The map starting coordinates, e.g. array( 'lat' => -34.397, 'lng' => 150.644 ). Overridden when markers are present.
  • $map_id: string; The unique identifier for the map.

pmpromd_override_first_marker

Override the location of the first marker placed on the map. Default: false.

apply_filters( 'pmpromd_override_first_marker', $override_first_marker_location, $map_id );

Parameters

  • $override_first_marker_location: mixed; The location to override the first marker with. Default false.
  • $map_id: string; The unique identifier for the map.

pmpromd_single_marker_content

Filter the infowindow HTML content for a single marker.

apply_filters( 'pmpromd_single_marker_content', $member_array['marker_content'], $member );

Parameters

  • $member_array['marker_content']: string; The infowindow HTML content for a single marker.
  • $member: object; The member the marker represents.

pmpromm_view_profile_text

Filter to adjust the text linking to the single Member Profile page as shown in the map marker.

apply_filters( 'pmpromm_view_profile_text', 'View Profile' );

Parameters

  • $view_profile_text: string; The text linking to the single Member Profile page shown in the map marker. Default View Profile.

pmpromd_maps_geocoding_api_key

Filter to adjust the geocoding API key. This is useful if you want to use a different API key for geocoding or test a key.

apply_filters( 'pmpromd_maps_geocoding_api_key', $map_api_key );

Parameters

  • $map_api_key: string; The geocoding API key.

pmpromd_map_styles

Filter the map styles. Map styles are passed as a JSON string and can be generated using this form.

apply_filters( 'pmpromd_map_styles', '', $map_id );

Parameters

  • $map_styles: string; The map styles as a JSON string.
  • $map_id: string; The unique identifier for the map.

pmpromd_map_cluster_markers

Control whether Google Maps markers are automatically grouped into clusters at lower zoom levels in the member directory map.

apply_filters( 'pmpromd_map_cluster_markers', true );

Parameters

  • $cluster_markers: bool; Whether markers are grouped into clusters at lower zoom levels. Default true.

Actions

pmpro_member_directory_before

Allows content to be inserted before the Member Directory content.

do_action( 'pmpro_member_directory_before', $sqlQuery, $shortcode_atts );

Parameters

  • $sqlQuery: string; The SQL query used to build the directory.
  • $shortcode_atts: array; The shortcode/block attributes.

pmpro_member_directory_after

Allows content to be inserted after the Member Directory content.

do_action( 'pmpro_member_directory_after', $sqlQuery, $shortcode_atts );

Parameters

  • $sqlQuery: string; The SQL query used to build the directory.
  • $shortcode_atts: array; The shortcode/block attributes.

pmpro_member_profile_before

Allows content to be inserted before the Member Profile content.

do_action( 'pmpro_member_profile_before', $pu );

Parameters

  • $pu: object; The profile user object.

pmpro_member_profile_after

Allows content to be inserted after the Member Profile content.

do_action( 'pmpro_member_profile_after', $pu );

Parameters

  • $pu: object; The profile user object.

Last updated on June 24, 2026


Was this article helpful?
YesNo