Private Message Button in Member List Loop
Try this in your functions.php or bp-custom.php file
Your link is not working anymore
Is it possible to explain how the code works?
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.
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 :}
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…
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
What’s different? The answer is in your reply “Thanks for that… ”
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
@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)…
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.
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() ) );
@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
- The topic ‘Private Message Button in Member List Loop’ is closed to new replies.