The buttons in a member’s profile header are gathered from the bp_localhero_member_actions filter instead of being echoed one after another onto bp_member_header_actions, so they can be ordered and grouped. There are two tiers only:
The More menu is a details element, so it opens without JavaScript. When open, it takes its own row under the primary buttons, with its actions outlined in a box and styled like the other header buttons, and its toggle reads Less. With JavaScript, it also closes on a click outside it or on Escape.
add_filter( 'bp_localhero_member_actions', function ( $actions, $user_id ) {
if ( ! is_user_logged_in() || get_current_user_id() === $user_id ) {
return $actions;
}
$actions['my-action'] = array(
'label' => __( 'Do something', 'my-plugin' ),
'url' => $url, // link target, or form target when method is post
'method' => 'post', // get (a link) or post (a form; url must carry _wpnonce)
'group' => 'more', // primary or more
'priority' => 50, // lower comes first within its group
'capability' => 'edit_users', // or array( capability, ...args )
'confirm' => __( 'Are you sure?', 'my-plugin' ),
);
return $actions;
}, 10, 2 );
Instead of url and label, an action can give a render callable, called with the displayed member’s ID and the action, which returns or echoes its own markup (for example a form it builds itself). Decide whether an action applies at all (logged out, own profile, relationship state) before adding it; an action whose markup comes out empty is left out. A confirm text is shown by the pack’s script before the link or form is followed.
bp_localhero_member_actions_primary_limit sets how many primary actions are shown as buttons (default 2). Primary actions beyond the limit go to the top of the More menu.
bp_member_header_actions still fires, inside the More menu, so buttons from plugins that have not moved to the filter (User Switching, for example) still appear there. A theme or plugin that overrides members/single/member-header.php or cover-image-header.php should call bp_localhero_theme_member_header_actions() in place of do_action( 'bp_member_header_actions' ); otherwise the registry’s actions are not shown. LH plugins move to the filter one at a time; LH Buddypress Block Members was the first.
Both member headers show the member’s full name as their heading, in place of BP Legacy’s @mention name.