Ticket #7640: 7640.patch
File 7640.patch, 5.6 KB (added by , 7 years ago) |
---|
-
src/bp-activity/bp-activity-template.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
3081 3081 * 3082 3082 * @since 1.2.0 3083 3083 * 3084 * @param int|null $user_id ID of the user. If null, will be used the displayed user ID 3084 3085 * 3085 3086 * @return string The public message link for the displayed user. 3086 3087 */ 3087 function bp_get_send_public_message_link() { 3088 function bp_get_send_public_message_link( $user_id = null ) { 3089 3090 $displayed_user_id = bp_displayed_user_id(); 3091 3092 $user_id = ( is_null( $user_id ) ) ? bp_displayed_user_id() : absint( $user_id ); 3088 3093 3089 3094 // No link if not logged in, not looking at someone else's profile. 3090 if ( ! is_user_logged_in() || ! bp_is_user() || bp_is_my_profile() ) {3095 if ( ! is_user_logged_in() || ( bp_is_my_profile() && $displayed_user_id == $user_id ) ) { 3091 3096 $retval = ''; 3092 3097 } else { 3093 $args = array( 'r' => bp_ get_displayed_user_mentionname() );3098 $args = array( 'r' => bp_activity_get_user_mentionname( $user_id ) ); 3094 3099 $url = add_query_arg( $args, bp_get_activity_directory_permalink() ); 3095 3100 $retval = wp_nonce_url( $url ); 3096 3101 } -
src/bp-messages/bp-messages-template.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
1355 1355 /** 1356 1356 * Generate the URL for the Private Message link in member profile headers. 1357 1357 * 1358 * @param int|null $user_id ID of the user. If null, will be used the displayed user ID 1359 * 1358 1360 * @return bool|string False on failure, otherwise the URL. 1359 1361 */ 1360 function bp_get_send_private_message_link( ) {1362 function bp_get_send_private_message_link( $user_id = null ) { 1361 1363 1362 if ( bp_is_my_profile() || ! is_user_logged_in() ) { 1364 $displayed_user_id = bp_displayed_user_id(); 1365 1366 $user_id = ( is_null( $user_id ) ) ? bp_displayed_user_id() : absint( $user_id ); 1367 1368 // No link if not logged in, not looking at someone else's profile. 1369 if ( ! is_user_logged_in() || ( bp_is_my_profile() && $displayed_user_id == $user_id ) ) { 1363 1370 return false; 1364 1371 } 1365 1372 … … 1370 1377 * 1371 1378 * @param string $value URL for the Private Message link in member profile headers. 1372 1379 */ 1373 return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( bp_displayed_user_id()) ) );1380 return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( $user_id ) ) ); 1374 1381 } 1375 1382 1376 1383 /** … … 1393 1400 } 1394 1401 /** 1395 1402 * Generate the 'Private Message' button for member profile headers. 1396 * 1403 * 1404 * @param array|string $args { 1405 * All arguments are optional. See {@link BP_Button} for complete 1406 * descriptions. 1407 * @type string $id Default: 'private_message'. 1408 * @type string $component Default: 'messages'. 1409 * @type bool $must_be_logged_in Default: true. 1410 * @type bool $block_self Default: true. 1411 * @type string $wrapper_id Default: 'send-private-message'. 1412 * @type string $link_href Default: the private message link for 1413 * the current member in the loop. 1414 * @type string $link_text Default: 'Private Message'. 1415 * @type string $link_class Default: 'send-message'. 1416 * } 1397 1417 * @return string 1398 1418 */ 1399 function bp_get_send_message_button() { 1400 // Note: 'bp_get_send_message_button' is a legacy filter. Use 1401 // 'bp_get_send_message_button_args' instead. See #4536. 1402 return apply_filters( 'bp_get_send_message_button', 1419 function bp_get_send_message_button( $args = '' ) { 1403 1420 1404 /** 1405 * Filters the "Private Message" button for member profile headers. 1406 * 1407 * @since 1.8.0 1408 * 1409 * @param array $value See {@link BP_Button}. 1410 */ 1411 bp_get_button( apply_filters( 'bp_get_send_message_button_args', array( 1412 'id' => 'private_message', 1413 'component' => 'messages', 1414 'must_be_logged_in' => true, 1415 'block_self' => true, 1416 'wrapper_id' => 'send-private-message', 1417 'link_href' => bp_get_send_private_message_link(), 1418 'link_text' => __( 'Private Message', 'buddypress' ), 1419 'link_class' => 'send-message', 1420 ) ) ) 1421 $r = bp_parse_args( $args, array( 1422 'id' => 'private_message', 1423 'component' => 'messages', 1424 'must_be_logged_in' => true, 1425 'block_self' => true, 1426 'wrapper_id' => 'send-private-message', 1427 'link_href' => bp_get_send_private_message_link(), 1428 'link_text' => __( 'Private Message', 'buddypress' ), 1429 'link_class' => 'send-message', 1430 ) ); 1431 1432 1433 // Note: 'bp_get_send_message_button' is a legacy filter. Use 1434 // 'bp_get_send_message_button_args' instead. See #4536. 1435 return apply_filters( 'bp_get_send_message_button', 1436 1437 /** 1438 * Filters the "Private Message" button for member profile headers. 1439 * 1440 * @since 1.8.0 1441 * 1442 * @param array $value See {@link BP_Button}. 1443 */ 1444 bp_get_button( apply_filters( 'bp_get_send_message_button_args', $r ) ) 1421 1445 ); 1422 1446 } 1423 1447