Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is there a template tag to display the ‘send private message’ button?

  • On the profile page there are three buttons

    1. send private message
    2. add friend
    3. send public message

    Does anyone know if there are template tags for these? i’d like to be able to display each button individually in my theme.

    Thanks in advance!

Viewing 13 replies - 1 through 13 (of 13 total)
  • OK i have managed to find

    bp_send_private_message_link and bp_send_private_message_link()

    This covers points 1 and 3 above.

    Does anyone know if there is a template tag for Add Friend button?

    bp_member_add_friend_button() you would find that by looking in the bp-friends-tamplate.php and to find it was in that file meant looking at the members loop to see how the action buttons are handled and tracing the do_action handle back to that template file you’ll then realise ‘bp_member_add_friend_button()’ echoes bp_get_add_friend_button() with passed args so you then need to trace that function to see further how the friends button works.

    In the profile we trace back to functions.php and find ‘bp_add_friend_button()’ that traces to various files, bp-friends-template.php the one of interest again.

    Thanks once again Hugo, you always have the solution!

    I was doing the sort of digging you describe yesterday in fact and was able to find out how to add a “Follow” button which may interest users of Andy’s plugin BuddyPress Followers:

    bp_follow_add_follow_button( bp_displayed_user_id() );


    Aventador
    Participant

    @strangerrj

    Hello Henry, my Englisch is not so good. Sorry.

    I do have 2 Problems, maybe you can help me: 1. send private message and 2. send public message doesn’t work but not like on the buddypress page itself. If for example click the private message, the message page opens without the address User name field, but it appears only an mempty field. Where is the mistake? And this could be handled and dissolve in an jquery colorbox or fancybox manner?

    Thanks R.


    talha8877
    Participant

    @talha8877

    Hi!

    I’m wondering if anybody figured out how to add a template tag for Add Friend button?

    Cheers


    danbpfr
    Participant

    @chouf1

    hi @talha8877,

    i think the answer is in bp-friends/bp-friends-templatetags.php:145

    https://codex.buddypress.org/developer/developer-docs/action-reference/friends/


    talha8877
    Participant

    @talha8877

    Hi Chouf,

    Thanks for the response. Although I’m having hard time connecting the dots.
    I’d already used
    `bp_add_friend_button( $user_ids[‘users’][$i]->id ) ?>`

    directly in my code but it didn’t return any results.
    Do I need to use an action hook to display it in posts?


    danbpfr
    Participant

    @chouf1

    By default, add as friend works only on the profile template or on the member template. So if you want to add this button into a post or in the post meta, it won’t work, i believe.
    You should call the good template part first and probably need to add the appropriate action hook, yes.

    Did you use the statement if ( bp_is_active( ‘friends’ ) ) before `bp_add_friend_button ?
    `


    myladeybugg
    Participant

    @myladeybugg

    Looking to do something similar, but I’m using the buddypress follow me plugin. I would like to display the “follow” button on my childsite’s sidebar.


    Aventador
    Participant

    @strangerrj

    Hello, I received the solution from houseofstrauss: https://wordpress.org/support/topic/get-the-user-id-for-pm-plugin?replies=2

    Thanx @houseofstrauss

    Is it also possible to integrate in buddypress the member header? The link work, but he does not detect the user from buddypress, the user I want to mail.

    And is it possible in the same window e.g. in Thickbox to open Colorbox or Lightbox?

    this link is:

    a href=”the_messaging_page/?pmaction=newmessage&to=<?php the_author_ID(); PM me

    the_author_ID is not correctly for Buddypress.

    Thanx Greetings R.


    talha8877
    Participant

    @talha8877

    Hi @strangerrj,
    How do you generate the /the_messaging_page/ part in php?

    @chouf1,
    I used it just like that inside the template but it didn’t return anything. But if I only use an action hook like
    `add_action( ‘the_content’, ‘bp_add_friend_button’, 5 );`
    Then the same button appears in all the posts. First I thought this worked but when I clicked the button all the buttons in all the posts became ‘cancel friendship request’


    Aventador
    Participant

    @strangerrj

    Hallo @talha8877

    Excuse me, my English is not so good, unfortunately.

    I used the plugin Cartpauj PM Plugin from Mingle, as I have found as yet no viable solution to the buttons (message etc) of the BuddyPress insertion into posts / Articels.

    So now I turn off the message part of BuddyPress and linking all the Cartpauj PM, which works wonderfully, except out of BuddyPress. There does not work.

    Of Cartpauj in single.php just the link:

    <a href = "/ news / pmaction newmessage = & to = “> Send

    . put But as I said, the link works in BuddyPress indeed, but does not with the member users, which I will write. Since I’m still looking for a solution. Evtentuell with: bp user id, funktioiert might not.

    So who has a solution to integrate Cartpauj PM in buddybress, bring it on.

    That´s it

    Thank you


    Aventador
    Participant

    @strangerrj

    Oh Sorry, I understand that the link is not used.

    So this:

    (a) href = “/ news / pmaction newmessage = & to = ” target = “_blank”> send message (a)

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Is there a template tag to display the ‘send private message’ button?’ is closed to new replies.
Skip to toolbar