Changeset 13437 for trunk/src/bp-groups/bp-groups-notifications.php
- Timestamp:
- 03/18/2023 09:42:31 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-notifications.php
r13436 r13437 52 52 /* translators: 1: the old group permalink. 2: the new group permalink. */ 53 53 _x( '* Permalink changed from "%1$s" to "%2$s".', 'Group update email text', 'buddypress' ), 54 esc_url( bp_get_group_ permalink( $old_group ) ),55 esc_url( bp_get_group_ permalink( $group ) )54 esc_url( bp_get_group_url( $old_group ) ), 55 esc_url( bp_get_group_url( $group ) ) 56 56 ); 57 57 } … … 90 90 'group' => $group, 91 91 'group.id' => $group_id, 92 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),92 'group.url' => esc_url( bp_get_group_url( $group ) ), 93 93 'group.name' => $group->name, 94 94 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), … … 216 216 'group.id' => $group_id, 217 217 'group.name' => $group->name, 218 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),218 'group.url' => esc_url( bp_get_group_url( $group ) ), 219 219 'requesting-user.id' => $requesting_user_id, 220 220 ), … … 291 291 'group' => $group, 292 292 'group.id' => $group_id, 293 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),293 'group.url' => esc_url( bp_get_group_url( $group ) ), 294 294 'group.name' => $group->name, 295 295 'promoted_to' => $promoted_to, … … 363 363 'tokens' => array( 364 364 'group' => $group, 365 'group.url' => bp_get_group_permalink( $group),365 'group.url' => esc_url( bp_get_group_url( $group ) ), 366 366 'group.name' => $group->name, 367 367 'inviter.name' => bp_core_get_userlink( $inviter_user_id, true, false ), … … 397 397 switch ( $action ) { 398 398 case 'new_membership_request': 399 $group_id = $item_id;399 $group_id = $item_id; 400 400 $requesting_user_id = $secondary_item_id; 401 401 402 $group = groups_get_group( $group_id ); 403 $group_link = bp_get_group_permalink( $group ); 404 $amount = 'single'; 405 406 // Set up the string and the filter 407 // because different values are passed to the filters, 408 // we'll return values inline. 402 $group = groups_get_group( $group_id ); 403 $group_link = bp_get_group_url( $group ); 404 $amount = 'single'; 405 406 /* 407 * Set up the string and the filter 408 * because different values are passed to the filters, 409 * we'll return values inline. 410 */ 409 411 if ( (int) $total_items > 1 ) { 410 412 /* translators: 1: number of group membership requests. 2: group name. */ 411 $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 412 $amount = 'multiple'; 413 $notification_link = $group_link . 'admin/membership-requests/?n=1'; 413 $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 414 $amount = 'multiple'; 415 $notification_link = add_query_arg( 416 array( 417 'n' => 1, 418 ), 419 bp_get_group_url( 420 $group, 421 array( 422 'single_item_action' => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ), 423 'single_item_action_variables' => array( bp_rewrites_get_slug( 'groups', 'bp_group_manage_membership_requests', 'membership-requests' ) ), 424 ) 425 ) 426 ); 414 427 415 428 if ( 'string' == $format ) { … … 430 443 * @param string $notification_link The permalink for notification. 431 444 */ 432 return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $total_items, $group->name, $text, $notification_link );445 return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $total_items, $group->name, $text, $notification_link ); 433 446 } else { 434 447 … … 455 468 } else { 456 469 $user_fullname = bp_core_get_user_displayname( $requesting_user_id ); 470 457 471 /* translators: %s: member name */ 458 $text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ); 459 $notification_link = $group_link . 'admin/membership-requests/?n=1'; 472 $text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname ); 473 $notification_link = $notification_link = add_query_arg( 474 array( 475 'n' => 1, 476 ), 477 bp_get_group_url( 478 $group, 479 array( 480 'single_item_action' => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ), 481 'single_item_action_variables' => array( bp_rewrites_get_slug( 'groups', 'bp_group_manage_membership_requests', 'membership-requests' ) ), 482 ) 483 ) 484 ); 460 485 461 486 if ( 'string' == $format ) { … … 476 501 * @param string $notification_link The permalink for notification. 477 502 */ 478 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );503 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link ); 479 504 } else { 480 505 … … 506 531 $group_id = $item_id; 507 532 508 $group = groups_get_group( $group_id );509 $group_link = bp_get_group_ permalink( $group );510 $amount = 'single';533 $group = groups_get_group( $group_id ); 534 $group_link = bp_get_group_url( $group ); 535 $amount = 'single'; 511 536 512 537 if ( (int) $total_items > 1 ) { 513 538 /* translators: 1: number of accepted group membership requests. 2: group name. */ 514 $text = sprintf( __( '%1$d accepted group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );515 $amount = 'multiple';539 $text = sprintf( __( '%1$d accepted group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 540 $amount = 'multiple'; 516 541 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 517 542 … … 530 555 * @param string $notification_link The permalink for notification. 531 556 */ 532 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $total_items, $group->name, $text, $notification_link );557 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $group->name, $text, $notification_link ); 533 558 } else { 534 559 … … 552 577 } else { 553 578 /* translators: %s: group name. */ 554 $text = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name );555 $filter = 'bp_groups_single_membership_request_accepted_notification';556 $notification_link = $group_link . '?n=1';579 $text = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name ); 580 $filter = 'bp_groups_single_membership_request_accepted_notification'; 581 $notification_link = add_query_arg( 'n', 1, $group_link ); 557 582 558 583 if ( 'string' == $format ) { … … 570 595 * @param string $notification_link The permalink for notification. 571 596 */ 572 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $group->name, $text, $notification_link );597 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link ); 573 598 } else { 574 599 … … 597 622 $group_id = $item_id; 598 623 599 $group = groups_get_group( $group_id );600 $group_link = bp_get_group_ permalink( $group );601 $amount = 'single';624 $group = groups_get_group( $group_id ); 625 $group_link = bp_get_group_url( $group ); 626 $amount = 'single'; 602 627 603 628 if ( (int) $total_items > 1 ) { 604 629 /* translators: 1: number of accepted group membership requests. 2: group name. */ 605 $text = sprintf( __( '%1$d rejected group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );606 $amount = 'multiple';630 $text = sprintf( __( '%1$d rejected group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name ); 631 $amount = 'multiple'; 607 632 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 608 633 … … 621 646 * @param string $notification_link The permalink for notification. 622 647 */ 623 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $total_items, $group->name, $text, $notification_link );648 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $group->name, $text, $notification_link ); 624 649 } else { 625 650 … … 643 668 } else { 644 669 /* translators: %s: group name. */ 645 $text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );646 $notification_link = $group_link . '?n=1';670 $text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name ); 671 $notification_link = add_query_arg( 'n', 1, $group_link ); 647 672 648 673 if ( 'string' == $format ) { … … 660 685 * @param string $notification_link The permalink for notification. 661 686 */ 662 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $group->name, $text, $notification_link );687 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link ); 663 688 } else { 664 689 … … 687 712 $group_id = $item_id; 688 713 689 $group = groups_get_group( $group_id );690 $group_link = bp_get_group_ permalink( $group );691 $amount = 'single';714 $group = groups_get_group( $group_id ); 715 $group_link = bp_get_group_url( $group ); 716 $amount = 'single'; 692 717 693 718 if ( (int) $total_items > 1 ) { 694 719 /* translators: %d: number of groups the user has been promoted admin for */ 695 $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );696 $amount = 'multiple';720 $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items ); 721 $amount = 'multiple'; 697 722 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 698 723 … … 709 734 * @param string $notification_link The permalink for notification. 710 735 */ 711 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $total_items, $text, $notification_link );736 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $text, $notification_link ); 712 737 } else { 713 738 /** … … 729 754 } else { 730 755 /* translators: %s: group name. */ 731 $text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );732 $notification_link = $group_link . '?n=1';756 $text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name ); 757 $notification_link = add_query_arg( 'n', 1, $group_link ); 733 758 734 759 if ( 'string' == $format ) { … … 745 770 * @param string $notification_link The permalink for notification. 746 771 */ 747 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $group->name, $text, $notification_link );772 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link ); 748 773 } else { 749 774 /** … … 771 796 $group_id = $item_id; 772 797 773 $group = groups_get_group( $group_id );774 $group_link = bp_get_group_ permalink( $group );775 $amount = 'single';798 $group = groups_get_group( $group_id ); 799 $group_link = bp_get_group_url( $group ); 800 $amount = 'single'; 776 801 777 802 if ( (int) $total_items > 1 ) { 778 803 /* translators: %d: number of groups the user has been promoted mod for */ 779 $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );780 $amount = 'multiple';804 $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items ); 805 $amount = 'multiple'; 781 806 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 782 807 … … 793 818 * @param string $notification_link The permalink for notification. 794 819 */ 795 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $total_items, $text, $notification_link );820 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $text, $notification_link ); 796 821 } else { 797 822 /** … … 813 838 } else { 814 839 /* translators: %s: group name. */ 815 $text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );816 $notification_link = $group_link . '?n=1';840 $text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name ); 841 $notification_link = add_query_arg( 'n', 1, $group_link ); 817 842 818 843 if ( 'string' == $format ) { … … 829 854 * @param string $notification_link The permalink for notification. 830 855 */ 831 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $group->name, $text, $notification_link );856 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link ); 832 857 } else { 833 858 /** … … 853 878 854 879 case 'group_invite': 855 $group_id = $item_id;856 $group = groups_get_group( $group_id );857 $group_link = bp_get_group_ permalink( $group );858 $amount = 'single';880 $group_id = $item_id; 881 $group = groups_get_group( $group_id ); 882 $group_link = bp_get_group_url( $group ); 883 $amount = 'single'; 859 884 860 885 $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1'; … … 897 922 } else { 898 923 /* translators: %s: group name. */ 899 $text = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name );924 $text = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name ); 900 925 $filter = 'bp_groups_single_group_invite_notification'; 901 926 … … 913 938 * @param string $notification_link The permalink for notification. 914 939 */ 915 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text. '</a>', $group_link, $group->name, $text, $notification_link );940 return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link ); 916 941 } else { 917 942 /** … … 1257 1282 'group.id' => $group_id, 1258 1283 'group.name' => $group->name, 1259 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),1284 'group.url' => esc_url( bp_get_group_url( $group ) ), 1260 1285 'leave-group.url' => esc_url( 1261 1286 bp_members_get_user_url(
Note: See TracChangeset
for help on using the changeset viewer.