[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 15:02:42 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:                |
--------------------------+----------------------

Comment (by sgr33n):

 This is how looks like :)


 {{{
 /**
  * Adds a new way to display the private message button, for inloop users.
 Ex. Users directory.
  *
  * @since SGR WP13 Theme 1.0
  */
 function sgrbp_send_message_inloop_button() {
         echo sgrbp_get_send_message_inloop_button();
 }

 function sgrbp_get_send_message_inloop_button() {
         // Note: 'bp_get_send_message_button' is a legacy filter. Use
         // 'bp_get_send_message_button_args' instead. See #4536
         return apply_filters( 'sgrbp_get_send_message_inloop_button',
                 bp_get_button( apply_filters(
 'bp_get_send_message_button_args', array(
                         'id'                => 'private_message',
                         'component'         => 'messages',
                         'must_be_logged_in' => true,
                         'block_self'        => true,
                         'wrapper_id'        => 'send-private-message',
                         'link_href'         =>
 sgrbp_get_send_private_message_inloop_link(),
                         'link_title'        => __( 'Send a private message
 to this user.', 'buddypress' ),
                         'link_text'         => __( 'Private Message',
 'buddypress' ),
                         'link_class'        => 'send-message',
                 ) ) )
         );
 }

 function sgrbp_send_private_message_inloop_link() {
         echo sgrbp_get_send_private_message_inloop_link();
 }

 function sgrbp_get_send_private_message_inloop_link() {

         if ( bp_is_my_profile() || !is_user_logged_in() )
                 return false;

         return apply_filters(
 'sgrbp_get_send_private_message_inloop_link', wp_nonce_url(
 bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' .
 bp_core_get_username( bp_get_member_user_id() ) ) );
 }

 /**
  * Add the Send message button to the directory members page.
  *
  * @since SGR WP13 Theme 1.0
  *
  * @return void
  */
 add_action( 'bp_directory_members_actions',
 'sgrbp_send_message_inloop_button' );
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5250#comment:3>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list