@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix content: <http://purl.org/rss/1.0/modules/content/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://lhero.org/portfolio/lh-buddypress-template-pack/>
  a sioc:Post ;
  dc:title "Member header actions" ;
  dcterms:identifier 152899 ;
  dc:modified "2026-10-31T12:12:14Z"^^xsd:dateTime ;
  dc:created "2026-10-31T12:12:14Z"^^xsd:dateTime ;
  sioc:link <https://lhero.org/portfolio/lh-buddypress-template-pack/member-header-actions/> ;
  sioc:has_creator <https://lhero.org/author/1/#account> ;
  sioc:has_container <https://lhero.org/#posts> ;
  content:encoded """<ul class="lh_portfolio-meta"><li><strong>Part of:</strong> <a href="https://lhero.org/portfolio/lh-buddypress-template-pack/">LH BuddyPress Template Pack</a></li></ul>
<p class="wp-block-paragraph">The buttons in a member&#8217;s profile header are gathered from the <code>bp_localhero_member_actions</code> filter instead of being echoed one after another onto <code>bp_member_header_actions</code>, so they can be ordered and grouped. There are two tiers only:</p>



<ul class="wp-block-list">
<li><strong>Primary</strong>: one or two key actions, shown as buttons. By default these are Add Friend (or the current friendship state) and Private Message.</li>



<li><strong>More</strong>: everything else, admin actions included, in a single More menu. There is no separate staff menu. Public Message (@mention) is here by default.</li>
</ul>



<p class="wp-block-paragraph">The More menu is a <code>details</code> 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.</p>



<h2 class="wp-block-heading">Adding an action</h2>



<pre class="wp-block-code"><code>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'      =&gt; __( 'Do something', 'my-plugin' ),
		'url'        =&gt; $url,      // link target, or form target when method is post
		'method'     =&gt; 'post',    // get (a link) or post (a form; url must carry _wpnonce)
		'group'      =&gt; 'more',    // primary or more
		'priority'   =&gt; 50,        // lower comes first within its group
		'capability' =&gt; 'edit_users', // or array( capability, ...args )
		'confirm'    =&gt; __( 'Are you sure?', 'my-plugin' ),
	);

	return $actions;
}, 10, 2 );</code></pre>



<p class="wp-block-paragraph">Instead of <code>url</code> and <code>label</code>, an action can give a <code>render</code> callable, called with the displayed member&#8217;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 <code>confirm</code> text is shown by the pack&#8217;s script before the link or form is followed.</p>



<p class="wp-block-paragraph"><code>bp_localhero_member_actions_primary_limit</code> sets how many primary actions are shown as buttons (default 2). Primary actions beyond the limit go to the top of the More menu.</p>



<h2 class="wp-block-heading">Back-compat</h2>



<p class="wp-block-paragraph"><code>bp_member_header_actions</code> 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 <code>members/single/member-header.php</code> or <code>cover-image-header.php</code> should call <code>bp_localhero_theme_member_header_actions()</code> in place of <code>do_action( 'bp_member_header_actions' )</code>; otherwise the registry&#8217;s actions are not shown. LH plugins move to the filter one at a time; LH Buddypress Block Members was the first.</p>



<h2 class="wp-block-heading">Member name</h2>



<p class="wp-block-paragraph">Both member headers show the member&#8217;s full name as their heading, in place of BP Legacy&#8217;s @mention name.</p>
"""^^rdf:XMLLiteral ;
  sioc:content """Part of: LH BuddyPress Template Pack
The buttons in a member&#8217;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:




Primary: one or two key actions, shown as buttons. By default these are Add Friend (or the current friendship state) and Private Message.



More: everything else, admin actions included, in a single More menu. There is no separate staff menu. Public Message (@mention) is here by default.




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.



Adding an action



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'      =&gt; __( 'Do something', 'my-plugin' ),
		'url'        =&gt; $url,      // link target, or form target when method is post
		'method'     =&gt; 'post',    // get (a link) or post (a form; url must carry _wpnonce)
		'group'      =&gt; 'more',    // primary or more
		'priority'   =&gt; 50,        // lower comes first within its group
		'capability' =&gt; 'edit_users', // or array( capability, ...args )
		'confirm'    =&gt; __( '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&#8217;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&#8217;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.



Back-compat



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&#8217;s actions are not shown. LH plugins move to the filter one at a time; LH Buddypress Block Members was the first.



Member name



Both member headers show the member&#8217;s full name as their heading, in place of BP Legacy&#8217;s @mention name.
""" ;
  sioc:topic <https://lhero.org/?taxonomy=author&term=cap-1> .

<https://lhero.org/author/1/#account> rdfs:seeAlso <https://lhero.org/author/1/?feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=author&term=cap-1> rdfs:seeAlso <https://lhero.org/?taxonomy=author&term=cap-1&feed=lhrdf&format=turtle> .
