Changeset 13299
- Timestamp:
- 07/22/2022 09:00:42 AM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r13215 r13299 3483 3483 * @since 1.2.0 3484 3484 * 3485 * @see bp_ get_send_public_message_button() for description of parameters.3486 * 3487 * @param array|string $args See {@link bp_ get_send_public_message_button()}.3485 * @see bp_activity_get_public_message_button_args() for description of parameters. 3486 * 3487 * @param array|string $args See {@link bp_activity_get_public_message_button_args()}. 3488 3488 */ 3489 3489 function bp_send_public_message_button( $args = '' ) { … … 3492 3492 3493 3493 /** 3494 * Return button for sending a public message (an @-mention). 3495 * 3496 * @since 1.2.0 3497 * 3494 * Get the arguments for the public message button. 3495 * 3496 * @since 11.0.0 3498 3497 * 3499 3498 * @param array|string $args { 3500 * All arguments are optional. See {@link BP_Button} for complete 3501 * descriptions. 3502 * @type string $id Default: 'public_message'. 3503 * @type string $component Default: 'activity'. 3504 * @type bool $must_be_logged_in Default: true. 3505 * @type bool $block_self Default: true. 3506 * @type string $wrapper_id Default: 'post-mention'. 3507 * @type string $link_href Default: the public message link for 3508 * the current member in the loop. 3509 * @type string $link_text Default: 'Public Message'. 3510 * @type string $link_class Default: 'activity-button mention'. 3499 * All arguments are optional. See {@link BP_Button} for complete 3500 * descriptions. 3501 * @type string $id Default: 'public_message'. 3502 * @type string $component Default: 'activity'. 3503 * @type bool $must_be_logged_in Default: true. 3504 * @type bool $block_self Default: true. 3505 * @type string $wrapper_id Default: 'post-mention'. 3506 * @type string $link_href Default: the public message link for 3507 * the current member in the loop. 3508 * @type string $link_title Default: 'Send a public message on your 3509 * activity stream.'. 3510 * @type string $link_text Default: 'Public Message'. 3511 * @type string $link_class Default: 'activity-button mention'. 3511 3512 * } 3512 * @return string The button for sending a public message. 3513 */ 3514 function bp_get_send_public_message_button( $args = '' ) { 3515 3516 $r = bp_parse_args( 3513 * @return array The arguments for the public message button. 3514 */ 3515 function bp_activity_get_public_message_button_args( $args = '' ) { 3516 $button_args = bp_parse_args( 3517 3517 $args, 3518 3518 array( … … 3523 3523 'wrapper_id' => 'post-mention', 3524 3524 'link_href' => bp_get_send_public_message_link(), 3525 'link_title' => __( 'Send a public message to this member.', 'buddypress' ), 3525 3526 'link_text' => __( 'Public Message', 'buddypress' ), 3526 3527 'link_class' => 'activity-button mention', … … 3533 3534 * @since 1.2.10 3534 3535 * 3535 * @param array $r Array of arguments for the public message button HTML. 3536 */ 3537 return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $r ) ); 3536 * @param array $button_args Array of arguments for the public message button HTML. 3537 */ 3538 return apply_filters( 'bp_get_send_public_message_button', $button_args ); 3539 } 3540 3541 /** 3542 * Return button for sending a public message (an @-mention). 3543 * 3544 * @since 1.2.0 3545 * @since 11.0.0 uses `bp_activity_get_public_message_button_args()`. 3546 * 3547 * @see bp_activity_get_public_message_button_args() for description of parameters. 3548 * 3549 * @param array|string $args See {@link bp_activity_get_public_message_button_args()}. 3550 * @return string The button for sending a public message. 3551 */ 3552 function bp_get_send_public_message_button( $args = '' ) { 3553 $button_args = bp_activity_get_public_message_button_args( $args ); 3554 3555 if ( ! array_filter( $button_args ) ) { 3556 return ''; 3557 } 3558 3559 return bp_get_button( $button_args ); 3538 3560 } 3539 3561 -
trunk/src/bp-templates/bp-nouveau/includes/members/template-tags.php
r13276 r13299 373 373 if ( 'profile' === $type ) { 374 374 if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) { 375 $button_args = bp_activity_get_public_message_button_args(); 376 375 377 /* 376 * This filter workaround is waiting for a core adaptation 377 * so that we can directly get the public message button arguments 378 * instead of the button. 379 * 380 * See https://buddypress.trac.wordpress.org/ticket/7126 378 * This button should remain as an anchor link. 379 * Hardcode the use of anchor elements if button arg passed in for other elements. 381 380 */ 382 add_filter( 'bp_get_send_public_message_button', 'bp_nouveau_members_catch_button_args', 100, 1 ); 383 384 bp_get_send_public_message_button(); 385 386 remove_filter( 'bp_get_send_public_message_button', 'bp_nouveau_members_catch_button_args', 100, 1 ); 387 388 if ( isset( bp_nouveau()->members->button_args ) && bp_nouveau()->members->button_args ) { 389 $button_args = bp_nouveau()->members->button_args; 390 391 /* 392 * This button should remain as an anchor link. 393 * Hardcode the use of anchor elements if button arg passed in for other elements. 394 */ 395 $buttons['public_message'] = array( 396 'id' => $button_args['id'], 397 'position' => 15, 398 'component' => $button_args['component'], 399 'must_be_logged_in' => $button_args['must_be_logged_in'], 400 'block_self' => $button_args['block_self'], 401 'parent_element' => $parent_element, 402 'button_element' => 'a', 403 'link_text' => $button_args['link_text'], 404 'parent_attr' => array( 405 'id' => $button_args['wrapper_id'], 406 'class' => $parent_class, 407 ), 408 'button_attr' => array( 409 'href' => $button_args['link_href'], 410 'id' => '', 411 'class' => $button_args['link_class'], 412 ), 413 ); 414 unset( bp_nouveau()->members->button_args ); 415 } 381 $buttons['public_message'] = array( 382 'id' => $button_args['id'], 383 'position' => 15, 384 'component' => $button_args['component'], 385 'must_be_logged_in' => $button_args['must_be_logged_in'], 386 'block_self' => $button_args['block_self'], 387 'parent_element' => $parent_element, 388 'button_element' => 'a', 389 'link_text' => $button_args['link_text'], 390 'link_title' => $button_args['link_title'], 391 'parent_attr' => array( 392 'id' => $button_args['wrapper_id'], 393 'class' => $parent_class, 394 ), 395 'button_attr' => array( 396 'href' => $button_args['link_href'], 397 'id' => '', 398 'class' => $button_args['link_class'], 399 ), 400 ); 416 401 } 417 402
Note: See TracChangeset
for help on using the changeset viewer.