[buddypress-trac] [BuddyPress] #4650: Handle buttons consistently to ease filtering

buddypress-trac noreply at wordpress.org
Wed Nov 7 10:19:00 UTC 2012


#4650: Handle buttons consistently to ease filtering
--------------------------+-----------------------------
 Reporter:  rogercoathup  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  1.7
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The call to create a send message button is passing an already created
 button, making it difficult (impossible?) to filter via
 'bp_get_send_message_button' filter.

 It should be handled differently the same way as the add friend button,
 where you can filter the array before the button is created.

 i.e.
 from bp_get_add_friend_button():

                 // Filter and return the HTML button
                 return bp_get_button( apply_filters(
 'bp_get_add_friend_button', $button ) );

 Which allows you to filter.

 Whereas, in bp_get_send_message_button():

         function bp_get_send_message_button() {
                 return apply_filters( 'bp_get_send_message_button',
                         bp_get_button( array(
                                 'id'                => 'private_message',
                                 'component'         => 'messages',
                                 'must_be_logged_in' => true,
                                 'block_self'        => true,
                                 'wrapper_id'        => 'send-private-
 message',
                                 'link_href'         =>
 bp_get_send_private_message_link(),
                                 'link_title'        => __( 'Send a private
 message to this user.', 'buddypress' ),
                                 'link_text'         => __( 'Private
 Message', 'buddypress' ),
                                 'link_class'        => 'send-message',
                         ) )
                 );
         }

 Which doesn't allow you to filter before the button is created.


 To fix:

 In bp_get_send_message_button(), the code should be changed to:


         function bp_get_send_message_button() {

                 $button = array(
                                 'id'                => 'private_message',
                                 'component'         => 'messages',
                                 'must_be_logged_in' => true,
                                 'block_self'        => true,
                                 'wrapper_id'        => 'send-private-
 message',
                                 'link_href'         =>
 bp_get_send_private_message_link(),
                                 'link_title'        => __( 'Send a private
 message to this user.', 'buddypress' ),
                                 'link_text'         => __( 'Private
 Message', 'buddypress' ),
                                 'link_class'        => 'send-message',
                         );

                 return bp_get_button ( apply_filters (
 'bp_get_send_message_button', $button );

         }

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4650>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list