Skip to:
Content
Pages
Categories
Search
Top
Bottom

Location of bp_member_header_actions ?

  • @hastig

    Participant

    I’m wanting to look at the code for bp_member_header_actions so I can write a function based on it.

    It’s the action that collectively outputs the avatar, add friend and private message buttons on a users profile page.

    I’ve searched all files in bp-core, bp-friends, bp-members and bp-messages.

    do_action( 'bp_member_header_actions' );

    I’m not even seeing it mentioned on http://phpxref.ftwr.co.uk/buddypress/

    Anybody know off hand where it is before I check everywhere else?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @danbp

    Participant

    @shanebp

    Moderator

    It doesn’t handle the avatar.
    It creates Friend, Public & Private messages buttons.
    And provides a hook for you to add another call.

    See function setup_actions() in this file for where it is hooked to create the default buttons:
    buddypress\bp-templates\bp-legacy\buddypress-functions.php

    @hastig

    Participant

    Thanks very much guys!

    Is it just my blind eyes or is hookr.io impossible to read? Font size is tiny, color is invisible. A fantastic resource though, bookmarked it, thanks again!

    For anybody interested, I just wanted a ‘send private message’ button that I could place anywhere on the page.

    The simple way seems to be to use this..

    <?php bp_send_private_message_button(); ?>

    On click it will open the send message page with the person you want to message already set.

    bp_send_private_message_button is a function that echos bp_get_send_message_button
    bp_send_private_message_button is located in /bp-messages/bp-messages-template.php

    source http://hookr.io/plugins/buddypress/2.4.3/functions/bp_send_private_message_button/

    if you’re wanting to change the text of the link you can add this to functions.php or bp-custom.php

    function custom_change_send_private_message_text($args) { 
    	$args[link_text] = 'send message'; 
    	return $args;
    }
    add_filter( 'bp_get_send_message_button_args', 'custom_change_send_private_message_text', 1, 1 );

    ..thats courtesy of shanebp..
    https://buddypress.org/support/topic/private-message-button-label-change/

    another version i was playing with if its of use to anyone..

    function custom_change_send_private_message_text($args) { 
    	$userName = bp_get_displayed_user_username();
    	$args[link_text] = 'send ' . $userName . ' a private message'; 
    	return $args;
    }
    add_filter( 'bp_get_send_message_button_args', 'custom_change_send_private_message_text', 1, 1 );

    ..you would have to figure out how to remove the hyphen from the username.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Location of bp_member_header_actions ?’ is closed to new replies.
Skip to toolbar