Skip to:
Content
Pages
Categories
Search
Top
Bottom

Private Message Button in Member List Loop

  • Avatar of azchipka
    azchipka
    Participant

    @azchipka

    I am hoping to add a private message button in the members list loop. Any one have any guidance?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Try this in your functions.php or bp-custom.php file

    https://gist.github.com/shanebp/5388770

    Avatar of funmi omoba
    funmi omoba
    Participant

    @funmi-omoba

    @shanebp,

    Your link is not working anymore

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @shanebp

    Is it possible to explain how the code works?

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Start with the add_action and follow the function calls.
    If you see a function that isn’t defined in the gist, then that function is in the codebase.
    Find and study it.

    The add_action calls a function that calls bp_send_message_button() which creates the button.
    Part of creating the button is creating the link.
    The link can be filtered – so look for apply_filters in that context.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Thanks for that! I can see now you’ve created a new function display_private_message_button which hooks on to action bp_directory_members_item in the members loop. Sorry for being slow, i got there in the end :}

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Interestingly I just tried this outside of the members loop. It doesn’t work on the friends list page. What is different about the friends loop and the members loop for this not to work? Humm…

    Avatar of valuser
    valuser
    Participant

    @valuser

    Thanks for function https://gist.github.com/shanebp/5391229

    works bp 1.7, wp 3.5.1, bbPress 2.3.1 Theme: Child of bp Befault

    Any chance that it might call up your BP Profile Message UX 1.1.3

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    @henrywright-1
    What’s different? The answer is in your reply “Thanks for that… ”

    @valuser
    That usage makes sense and has been mentioned by others.
    But it’s not a simple tweak.
    And would require an admin screen so you could choose to show / not show the button in loops.
    And etc. etc.
    I’ll write an article in the next week or so on
    PhiloPress

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @shanebp you mean the bp_directory_members_item is different? That is the same in both the members directory and the friends list (both use the members loop)…

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    @henrywright-1

    I’m not going to spoon-feed this to you.
    But you’re on the right track.
    ( I should have said ‘ The clue is in your reply…’ )
    You’ve found what is the same in those two situations.
    So what is different about them ?

    Sometimes it’s easier to start anew.
    For example – instead of ‘how to I change this to do that’, start with ‘how do I do that’.

    Use echo to confirm the required variables.
    Use var_dump to expose all the fields in objects.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @shanebpdev

    For the life of me I cannot figure out why it doesn’t work for the friends loop. Am I missing something glaringly obvious?

    Anyway I thought why not just build the link and throw it directly in the friends template?

    echo wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_get_member_user_id() ) );

    Avatar of kizmark
    kizmark
    Participant

    @kizmark

    @Henry, Did you got it solved?

    I’m having the same question.. I want to get the link to have a send private message button

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @kizmark

    I’m still scratching my head with this one. It must be my install playing games. In the end I got it working with

    Anyway I thought why not just build the link and throw it directly in the friends template?

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

You must be logged in to reply to this topic.