Skip to:
Content
Pages
Categories
Search
Top
Bottom

Private Message Button in Member List Loop

  • @azchipka

    Participant

    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)
  • @shanebp

    Moderator

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

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

    @funmi-omoba

    Participant

    @shanebp,

    Your link is not working anymore

    @shanebp

    Moderator

    @henrywright-1

    Member

    @shanebp

    Is it possible to explain how the code works?

    @shanebp

    Moderator

    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.

    @henrywright-1

    Member

    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 :}

    @henrywright-1

    Member

    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…

    @valuser

    Participant

    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

    @shanebp

    Moderator

    @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

    @henrywright-1

    Member

    @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)…

    @shanebp

    Moderator

    @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.

    @henrywright-1

    Member

    @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() ) );

    @kizmark

    Participant

    @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

    @henrywright-1

    Member

    @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)
  • The topic ‘Private Message Button in Member List Loop’ is closed to new replies.
Skip to toolbar