Changeset 13300
- Timestamp:
- 07/22/2022 09:32:13 AM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-template.php
r13295 r13300 1505 1505 * @since 3.0.0 Added `$args` parameter. 1506 1506 * 1507 * @param array|string $args See {@link bp_get_send_message_button()}. 1507 * @see bp_get_send_message_button_args() for description of parameters. 1508 * 1509 * @param array|string $args See {@link bp_get_send_message_button_args()}. 1508 1510 */ 1509 1511 function bp_send_message_button( $args = '' ) { 1510 1512 echo bp_get_send_message_button( $args ); 1511 1513 } 1512 /** 1513 * Generate the 'Private Message' button for member profile headers.1514 * 1515 * @since 1.2.01516 * @since 3.0.0 Added `$args` parameter.1514 1515 /** 1516 * Get the arguments for the private message button. 1517 * 1518 * @since 11.0.0 1517 1519 * 1518 1520 * @param array|string $args { 1519 * All arguments are optional. See {@link BP_Button} for complete 1520 * descriptions. 1521 * @type string $id Default: 'private_message'. 1522 * @type string $component Default: 'messages'. 1523 * @type bool $must_be_logged_in Default: true. 1524 * @type bool $block_self Default: true. 1525 * @type string $wrapper_id Default: 'send-private-message'. 1526 * @type string $link_href Default: the private message link for 1527 * the current member in the loop. 1528 * @type string $link_text Default: 'Private Message'. 1529 * @type string $link_class Default: 'send-message'. 1521 * All arguments are optional. See {@link BP_Button} for complete 1522 * descriptions. 1523 * @type string $id Default: 'private_message'. 1524 * @type string $component Default: 'messages'. 1525 * @type bool $must_be_logged_in Default: true. 1526 * @type bool $block_self Default: true. 1527 * @type string $wrapper_id Default: 'send-private-message'. 1528 * @type string $link_href Default: the private message link for 1529 * the current member in the loop. 1530 * @type string $link_title Default: 'Send a private message to this member.'. 1531 * @type string $link_text Default: 'Private Message'. 1532 * @type string $link_class Default: 'send-message'. 1530 1533 * } 1531 * @return string 1532 */ 1533 function bp_get_send_message_button( $args = '' ) { 1534 1535 $r = bp_parse_args( 1534 * @return array The arguments for the public message button. 1535 */ 1536 function bp_get_send_message_button_args( $args = '' ) { 1537 $button_args = bp_parse_args( 1536 1538 $args, 1537 1539 array( … … 1543 1545 'link_href' => bp_get_send_private_message_link(), 1544 1546 'link_text' => __( 'Private Message', 'buddypress' ), 1547 'link_title' => __( 'Send a private message to this member.', 'buddypress' ), 1545 1548 'link_class' => 'send-message', 1546 1549 ) 1547 1550 ); 1548 1551 1549 // Note: 'bp_get_send_message_button' is a legacy filter. Use 1550 // 'bp_get_send_message_button_args' instead. See #4536. 1551 return apply_filters( 'bp_get_send_message_button', 1552 1553 /** 1554 * Filters the "Private Message" button for member profile headers. 1555 * 1556 * @since 1.8.0 1557 * 1558 * @param array $value See {@link BP_Button}. 1559 */ 1560 bp_get_button( apply_filters( 'bp_get_send_message_button_args', $r ) ) 1552 /** 1553 * Filters the "Private Message" button for member profile headers. 1554 * 1555 * @since 1.8.0 1556 * 1557 * @param array $button_args See {@link BP_Button}. 1558 */ 1559 return apply_filters( 'bp_get_send_message_button_args', $button_args ); 1560 } 1561 1562 /** 1563 * Generate the 'Private Message' button for member profile headers. 1564 * 1565 * @since 1.2.0 1566 * @since 3.0.0 Added `$args` parameter. 1567 * @since 11.0.0 uses `bp_get_send_message_button_args()`. 1568 * 1569 * @see bp_get_send_message_button_args() for description of parameters. 1570 * 1571 * @param array|string $args See {@link bp_get_send_message_button_args()}. 1572 * @return string 1573 */ 1574 function bp_get_send_message_button( $args = '' ) { 1575 $button_args = bp_get_send_message_button_args( $args ); 1576 1577 if ( ! array_filter( $button_args ) ) { 1578 return ''; 1579 } 1580 1581 /** This filter is documented in wp-includes/deprecated.php */ 1582 $button = apply_filters_deprecated( 1583 'bp_get_send_message_button', 1584 array( bp_get_button( $button_args ) ), 1585 '1.8.0', 1586 'bp_get_send_message_button_args' 1561 1587 ); 1588 1589 return $button; 1562 1590 } 1563 1591 -
trunk/src/bp-templates/bp-nouveau/includes/members/template-tags.php
r13299 r13300 402 402 403 403 if ( bp_is_active( 'messages' ) ) { 404 /**405 * This filter workaround is waiting for a core adaptation 406 * so that we can directly get the private messages button arguments407 * instead of the button.408 * @see https://buddypress.trac.wordpress.org/ticket/7126404 $button_args = bp_get_send_message_button_args(); 405 406 /* 407 * This button should remain as an anchor link. 408 * Hardcode the use of anchor elements if button arg passed in for other elements. 409 409 */ 410 add_filter( 'bp_get_send_message_button_args', 'bp_nouveau_members_catch_button_args', 100, 1 ); 411 412 bp_get_send_message_button(); 413 414 remove_filter( 'bp_get_send_message_button_args', 'bp_nouveau_members_catch_button_args', 100, 1 ); 415 416 if ( isset( bp_nouveau()->members->button_args ) && bp_nouveau()->members->button_args ) { 417 $button_args = bp_nouveau()->members->button_args; 418 419 /* 420 * This button should remain as an anchor link. 421 * Hardcode the use of anchor elements if button arg passed in for other elements. 422 */ 423 $buttons['private_message'] = array( 424 'id' => $button_args['id'], 425 'position' => 25, 426 'component' => $button_args['component'], 427 'must_be_logged_in' => $button_args['must_be_logged_in'], 428 'block_self' => $button_args['block_self'], 429 'parent_element' => $parent_element, 430 'button_element' => 'a', 431 'link_text' => $button_args['link_text'], 432 'parent_attr' => array( 433 'id' => $button_args['wrapper_id'], 434 'class' => $parent_class, 435 ), 436 'button_attr' => array( 437 'href' => bp_get_send_private_message_link(), 438 'id' => false, 439 'class' => $button_args['link_class'], 440 'rel' => '', 441 'title' => '', 442 ), 443 ); 444 445 unset( bp_nouveau()->members->button_args ); 446 } 410 $buttons['private_message'] = array( 411 'id' => $button_args['id'], 412 'position' => 25, 413 'component' => $button_args['component'], 414 'must_be_logged_in' => $button_args['must_be_logged_in'], 415 'block_self' => $button_args['block_self'], 416 'parent_element' => $parent_element, 417 'button_element' => 'a', 418 'link_text' => $button_args['link_text'], 419 'link_title' => $button_args['link_title'], 420 'parent_attr' => array( 421 'id' => $button_args['wrapper_id'], 422 'class' => $parent_class, 423 ), 424 'button_attr' => array( 425 'href' => bp_get_send_private_message_link(), 426 'id' => false, 427 'class' => $button_args['link_class'], 428 'rel' => '', 429 'title' => '', 430 ), 431 ); 447 432 } 448 433 }
Note: See TracChangeset
for help on using the changeset viewer.