Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#4650 closed enhancement (duplicate)

bp_get_send_message_button filter can't work

Reported by: rogercoathup's profile rogercoathup Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.2.6
Component: Core Keywords:
Cc:

Description

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 );

}

Change History (5)

#1 @rogercoathup
12 years ago

  • Summary changed from Handle buttons consistently to ease filtering to bp_get_send_message_button filter can't work

#2 @rogercoathup
12 years ago

Missing a bracket in suggested fix. Correct is:

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 ) );
}

#3 @DJPaul
12 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement
  • Version changed from 1.7 to 1.2.6

#4 @boonebgorges
11 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Closing as a duplicate of #4536

#5 @DJPaul
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.