Extend or override the profile page

MemberMode renders public profiles from templates/profile.php in the plugin folder. You can change the output two ways: (1) extension hooks for additive tweaks like extra action buttons, or (2) a full template override in your theme.

Option 1 — Extension hooks (additive)

These are the public filters that affect the profile UI. Each is safe to use without losing future plugin updates.

membermode_profile_actions

Add buttons next to “Edit profile” in the profile header. Each entry is the full HTML for one button.

// Add a "Send message" button on every profile.
add_filter( 'membermode_profile_actions', function ( array $actions, int $user_id ): array {
    $actions[] = sprintf(
        '<a class="membermode-btn membermode-btn--secondary" href="%s">%s</a>',
        esc_url( home_url( '/messages/?to=' . $user_id ) ),
        esc_html__( 'Send message', 'mytheme' )
    );
    return $actions;
}, 10, 2 );

Role-aware example — show an “Edit user in wp-admin” shortcut only when the visitor is an admin/editor:

add_filter( 'membermode_profile_actions', function ( array $actions, int $user_id ): array {
    if ( ! current_user_can( 'edit_users' ) ) {
        return $actions;
    }
    $actions[] = sprintf(
        '<a class="membermode-btn membermode-btn--secondary" href="%s">%s</a>',
        esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ),
        esc_html__( 'Edit user', 'mytheme' )
    );
    return $actions;
}, 10, 2 );

membermode_profile_can_view

Override the privacy check (return true / false to allow / deny, or null to fall through to the default privacy logic).

// Let any user with the WordPress 'edit_users' capability (admin, editor)
// see all profiles regardless of the owner's privacy level.
add_filter( 'membermode_profile_can_view', function ( $allow, int $owner_id, int $viewer_id, string $level ) {
    if ( $viewer_id && user_can( $viewer_id, 'edit_users' ) ) {
        return true;
    }
    return $allow;
}, 10, 4 );

Restrict by role instead of capability — e.g. only members with the subscriber role and above can see profiles:

add_filter( 'membermode_profile_can_view', function ( $allow, int $owner_id, int $viewer_id, string $level ) {
    if ( ! $viewer_id ) {
        return false;
    }
    $viewer = get_userdata( $viewer_id );
    $allowed = array( 'subscriber', 'contributor', 'author', 'editor', 'administrator' );
    if ( ! array_intersect( (array) $viewer->roles, $allowed ) ) {
        return false;
    }
    return $allow;
}, 10, 4 );

membermode_profile_admin_menu_items

Add entries to the admin “more actions” menu shown to admins viewing a profile.

add_filter( 'membermode_profile_admin_menu_items', function ( array $items, int $user_id ): array {
    $items[] = array(
        'label' => __( 'View orders', 'mytheme' ),
        'url'   => admin_url( 'edit.php?post_type=shop_order&_customer_user=' . $user_id ),
    );
    return $items;
}, 10, 2 );

Option 2 — Template override (full control)

Drop templates/profile.php from the plugin into your active theme as membermode/profile.php. WordPress’s template hierarchy picks up your copy. From there, edit any markup directly. The $context variable (ProfileContext) is in scope and exposes:

  • $context->userWP_User
  • $context->display_name, $context->bio, $context->avatar_url, $context->cover_url
  • $context->fields — keyed array of profile field values (incl. social_profiles)
  • $context->tabs — registered tabs
  • $context->is_owner, $context->can_edit, $context->privacy_level

Trade-off: template overrides drift from the plugin over time — when MemberMode adds new features to profile.php, your override won’t get them automatically.

Which option to pick

  • One badge / one extra button / hide one element: hooks (Option 1).
  • Whole new layout, custom tabs in different positions: template override (Option 2).
  • Just CSS tweaks: neither — target the existing classes (e.g. .membermode-profile__header, .membermode-profile__avatar) from your theme stylesheet.