[buddypress-trac] [BuddyPress] #5250: bp_send_message_button() doesn't get member id in members-loop.php
buddypress-trac
noreply at wordpress.org
Thu Nov 21 01:10:50 UTC 2013
#5250: bp_send_message_button() doesn't get member id in members-loop.php
--------------------------+----------------------
Reporter: sgr33n | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Core | Version:
Severity: normal | Resolution: invalid
Keywords: |
--------------------------+----------------------
Changes (by boonebgorges):
* status: new => closed
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
This is expected behavior, though not very well documented.
`bp_send_message_button()` uses `bp_get_send_private_message_link()` to
create its URL. That function, in turn, uses `bp_displayed_user_id()` to
determine the ID of the "destination" user. On member profile pages - ie
when using member-header.php - the "displayed user" is defined. But there
is no single "displayed user" when you're in the loop on the members
directory.
This is part of a larger pattern in BuddyPress: we have functions that are
intended for use in loops, and those that are intended for use on single-
item pages.
In this specific case, I don't think BP has a function for doing exactly
what you're trying to do. So, I'd suggest creating your own. Just copy the
content of `bp_send_message_button()` into your theme, change its name,
and then change the way that the 'link_href' param is determined: use the
logic from `bp_get_send_private_message_link()`, but use
`bp_get_member_user_id()` instead of `bp_displayed_user_id()` (the former
is the loop function for getting the ID of the current user).
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5250#comment:1>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list