- Timestamp:
- 03/27/2023 06:19:06 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r13437 r13442 7 7 * @package BuddyPress 8 8 * @subpackage BP_Theme_Compat 9 * @version 1 0.0.09 * @version 12.0.0 10 10 */ 11 11 … … 908 908 909 909 $scope = ''; 910 if ( ! empty( $_POST['scope'] ) ) 910 if ( ! empty( $_POST['scope'] ) ) { 911 911 $scope = $_POST['scope']; 912 } 913 914 $activity_slug = bp_get_activity_slug(); 915 $custom_activity_slug = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ); 912 916 913 917 // We need to calculate and return the feed URL for each scope. 914 918 switch ( $scope ) { 915 919 case 'friends': 916 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/'; 920 $feed_url = bp_loggedin_user_url( 921 array( 922 'single_item_component' => $custom_activity_slug, 923 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_friends', 'friends' ), 924 'single_item_action_variables' => array( 'feed' ), 925 ) 926 ); 917 927 break; 918 928 case 'groups': 919 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/'; 929 $feed_url = bp_loggedin_user_url( 930 array( 931 'single_item_component' => $custom_activity_slug, 932 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_groups', 'groups' ), 933 'single_item_action_variables' => array( 'feed' ), 934 ) 935 ); 920 936 break; 921 937 case 'favorites': 922 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 938 $feed_url = bp_loggedin_user_url( 939 array( 940 'single_item_component' => $custom_activity_slug, 941 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ), 942 'single_item_action_variables' => array( 'feed' ), 943 ) 944 ); 923 945 break; 924 946 case 'mentions': 925 $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 947 $feed_url = bp_loggedin_user_url( 948 array( 949 'single_item_component' => $custom_activity_slug, 950 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ), 951 'single_item_action_variables' => array( 'feed' ), 952 ) 953 ); 926 954 927 955 if ( isset( $_POST['_wpnonce_activity_filter'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce_activity_filter'] ), 'activity_filter' ) ) { … … 1454 1482 } 1455 1483 1484 $friends_slug = bp_get_friends_slug(); 1485 $custom_friends_slug = bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ); 1486 1456 1487 // Trying to cancel friendship. 1457 1488 if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $friend_id ) ) { … … 1461 1492 echo __( 'Friendship could not be canceled.', 'buddypress' ); 1462 1493 } else { 1463 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1494 $url = bp_loggedin_user_url( 1495 array( 1496 'single_item_component' => $custom_friends_slug, 1497 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_add_friend', 'add-friend' ), 1498 'single_item_action_variables' => array( $friend_id ), 1499 ) 1500 ); 1501 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( $url, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1464 1502 } 1465 1503 … … 1471 1509 echo __(' Friendship could not be requested.', 'buddypress' ); 1472 1510 } else { 1473 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="remove friendship-button pending_friend requested" rel="remove" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $friend_id . '/', 'friends_withdraw_friendship' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'buddypress' ) . '</a>'; 1511 $url = bp_loggedin_user_url( 1512 array( 1513 'single_item_component' => $custom_friends_slug, 1514 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests', 'requests' ), 1515 'single_item_action_variables' => array( 1516 bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_requests_cancel', 'cancel' ), 1517 $friend_id, 1518 ), 1519 ) 1520 ); 1521 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="remove friendship-button pending_friend requested" rel="remove" href="' . wp_nonce_url( $url, 'friends_withdraw_friendship' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'buddypress' ) . '</a>'; 1474 1522 } 1475 1523 … … 1479 1527 1480 1528 if ( friends_withdraw_friendship( bp_loggedin_user_id(), $friend_id ) ) { 1481 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $friend_id, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1529 $url = bp_loggedin_user_url( 1530 array( 1531 'single_item_component' => $custom_friends_slug, 1532 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_add_friend', 'add-friend' ), 1533 'single_item_action_variables' => array( 1534 $friend_id, 1535 ), 1536 ) 1537 ); 1538 echo '<a id="friend-' . esc_attr( $friend_id ) . '" class="friendship-button not_friends add" rel="add" href="' . wp_nonce_url( $url, 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 1482 1539 } else { 1483 1540 echo __("Friendship request could not be cancelled.", 'buddypress');
Note: See TracChangeset
for help on using the changeset viewer.