Skip to content

Views sub-tab on the member profile

Every logged-in member gets a Views sub-tab on their own BuddyPress profile. The sub-tab shows a chart of recent profile-view activity plus a list of recent visitors with avatars and timestamps.

Member’s Views sub-tab

  • A chart rendered by Chart.js — line, bar, or polar-area, set by the admin under Display → Chart style.
  • A filter dropdown above the chart with four options: Today, Last 7 days, Last 30 days, All time.
  • A “Recent Visitors” list under the chart with avatar, display name, and a relative timestamp (“Viewed 4 days ago”).
  • Quick-action buttons next to each visitor (e.g. Add Friend, Message) when those BuddyPress components are active.

The sub-tab is only visible on the member’s own profile — visitors browsing to someone else’s profile do not see it. The screen function is gated by bp_is_my_profile().

Under bp_setup_nav the plugin registers a sub-nav with slug profile-views at position 75. URL pattern:

/members/{slug}/profile-views/

The dropdown POSTs to wp_ajax_bp_profile_views_load_chart_widget. The PHP handler:

  1. Verifies the requester is the displayed user.
  2. Verifies the AJAX nonce ajax-nonce.
  3. Pulls rows from {prefix}bp_profile_views where user_id = displayed_user_id and the date range matches the filter.
  4. Returns a JSON payload of { labels, data, totals } consumable by Chart.js.

If the visitor count for the selected window is zero, the area beneath the chart shows a “No views found” message instead of the recent-visitors list.

If the admin has enabled Allow user settings, the Views tab also exposes a toggle that lets the member decide whether their own visits to other people’s profiles are tracked. See Per-user opt-out.

The Views tab content is split into two partials so theme authors can target one without affecting the other:

  • public/partials/bp-profile-views-nouveau-tab-content.php — when BP Nouveau is active.
  • public/partials/bp-profile-views-legacy-tab-content.php — when BP Legacy or older themes are active.

Override either one by copying it to wp-content/themes/your-theme/buddypress/who-viewed-my-profile/{partial-name}.php. See Theme overrides.