Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] How to add a custom Button in members header/profile page


  • jaybee08
    Participant

    @jaybee08

    Hi I would like to add a custom button on the members header file. Does anybody knows how to do it?

Viewing 7 replies - 1 through 7 (of 7 total)

  • danbp
    Moderator

    @danbp

    Hi @jaybee08,

    try this:

    function my_custom_button() {
     // your button here
    echo ' <br/><div class="mcb"><a href="#" title="">blabla</a><div> ';
    
    }
    add_filter( 'bp_before_member_header_meta', 'my_custom_button' );

    Add the function to your child theme’s functions.php or to bp-custom.php


    jaybee08
    Participant

    @jaybee08

    Hi danbp, Thank you for your quick response. I tried putting the line of codes in my child themes function.php but it doesn’t work.


    danbp
    Moderator

    @danbp

    This code was tested today on BP 2.1 and 2013 theme ! Copy/pasting from here works also.

    Maybe remove the div wich can give some wrong output depending of your theme.
    Anyway you have to style it (css) to see the button correctly.


    jaybee08
    Participant

    @jaybee08

    Hi @danbp, I removed the div and still don’t work. I also switched to the buddypress default theme and 2014 and no luck.

    However, I tried using other filter like bp_get_send_public_message_button and it shows. But I think using that filter is not ideal. What do you suggest?

    Thanks again for your help. I really appreciate it. 🙂


    danbp
    Moderator

    @danbp

    I can’t suggest anything because i’m wondering why the code doesn’t work on your site.
    Personnally I use this code from within bp-custom. Have you tried that ?

    You also give much details about what you exactly try to do.

    Adding a button into plugin who contains many by default is like diving in a hay stack !
    Wich button or really really custom for going on another page or what ?

    Where ideally should he appear ?
    Who can use it ?

    Each header has at least 6 or seven placeholder, only for positionning something in case off, so there’s no need effectively to use a more dedicated filter like the one you tell.


    jaybee08
    Participant

    @jaybee08

    Hi @danbp, just a custom javascript action for a chat function “Chat

    and perhaps will add few buttons.

    Actually, I didn’t try bp-custom template. Could I use that on my child theme?

    Thanks much.


    danbp
    Moderator

    @danbp

    I suggest you to read carefully the BP Codex (ie. anything about JS handling). 😉
    And for the present case: https://codex.buddypress.org/plugindev/bp-custom-php/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] How to add a custom Button in members header/profile page’ is closed to new replies.
Skip to toolbar