[buddypress-trac] [BuddyPress] #2566: [patch] “Send Private Message” and “Mention this User” Button Filtering

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Aug 23 13:37:35 UTC 2010


#2566: [patch] “Send Private Message” and “Mention this User” Button Filtering
-----------------------+----------------------------------------------------
 Reporter:  jeffsayre  |       Owner:  jeffsayre                                         
     Type:  defect     |      Status:  new                                               
 Priority:  major      |   Milestone:  1.2.6                                             
Component:  Core       |    Keywords:  has-patch, security, privacy, abstraction, filters
-----------------------+----------------------------------------------------

Comment(by jeffsayre):

 I agree with hnla.

 The only reason that I extracted the markup into a core function is to
 keep consistency with the “Add Friend” button as that is how it is done in
 that button's function. However, if only the actual outputted HTML was
 keep in all of these button functions, that would be better. In other
 words, keep the markup in the template files and use it to wrap the
 function call.

 So, if this was the code for the “Send Private Message” button in the
 template:


 {{{
 <?php if ( is_user_logged_in() && !bp_is_my_profile() && function_exists(
 'bp_send_private_message_link' ) ) : ?>
      <div class="generic-button" id="send-private-message">
           <?php if ( function_exists( 'bp_send_private_message_link' ) ) :
 ?>
                <?php bp_send_private_message_link() ?>
      </div>
 <?php endif; ?>
 }}}


 Then this would be the filterable output in the
 bp_send_private_message_link() function:


 {{{
 $button = '<a href="' . wp_nonce_url( $bp->loggedin_user->domain .
 $bp->activity->slug .
 '/?r=' . bp_core_get_username( $bp->displayed_user->user_id,
 $bp->displayed_user->userdata->user_nicename,
 $bp->displayed_user->userdata->user_login ) ) . '" title="' . __( 'Mention
 this user in a new public message, this will
 send the user a notification to get their attention.', 'buddypress' ) .
 '">' . __( 'Mention this User', 'buddypress' );
 }}}


 This should be the way it is done for all three buttons: the “Add Friend”
 button, the “Mention this User” button, and the “Send Private Message”
 button. It should also be the way it is handled for any other button that
 a developer may wish to have control over.

 Let me know if you want me to repatch this with the above solution.

-- 
Ticket URL: <https://trac.buddypress.org/ticket/2566#comment:10>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list