Changeset 13443 for trunk/src/bp-members/bp-members-template.php
- Timestamp:
- 03/31/2023 05:26:39 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-template.php
r13442 r13443 1876 1876 * 1877 1877 * @since 1.2.4 1878 */ 1879 function bp_displayed_user_link() { 1880 echo esc_url( bp_displayed_user_url() ); 1878 * @since 12.0.0 Introduced the `$chunk` argument. 1879 * 1880 * @param array $chunk A list of slugs to append to the URL. 1881 */ 1882 function bp_displayed_user_link( $chunks = array() ) { 1883 $path_chunks = array(); 1884 $chunks = (array) $chunks; 1885 1886 if ( $chunks ) { 1887 $path_chunks = bp_members_get_path_chunks( $chunks ); 1888 } 1889 1890 echo esc_url( bp_displayed_user_url( $path_chunks ) ); 1881 1891 } 1882 1892 … … 1962 1972 1963 1973 if ( $chunks ) { 1964 $single_item_component = array_shift( $chunks ); 1965 if ( $single_item_component ) { 1966 $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component, $single_item_component ); 1967 } 1968 1969 $single_item_action = array_shift( $chunks ); 1970 if ( $single_item_action ) { 1971 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action, $single_item_action ); 1972 } 1973 1974 if ( $chunks ) { 1975 foreach ( $chunks as $chunk ) { 1976 $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action . '_' . $chunk, $chunk ); 1977 } 1978 } 1974 $path_chunks = bp_members_get_path_chunks( $chunks ); 1979 1975 } 1980 1976 … … 3098 3094 } 3099 3095 3096 $path_chunks = array( 3097 'single_item_component' => $bp->{$component}->slug, 3098 ); 3099 3100 3100 // Append $action to $url if there is no $type. 3101 3101 if ( ! empty( $action ) ) { 3102 $url = bp_displayed_user_domain() . $bp->{$component}->slug . '/' . $action; 3103 } else { 3104 $url = bp_displayed_user_domain() . $bp->{$component}->slug; 3102 $action_rewrite_id = 'member_' . str_replace( '-', '_', $action ); 3103 $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', $action_rewrite_id, $action ); 3105 3104 } 3106 3105 3107 3106 // Add a slash at the end of our user url. 3108 $url = trailingslashit( $url);3107 $url = bp_displayed_user_url( $path_chunks ); 3109 3108 3110 3109 // Add possible query arg. … … 3145 3144 */ 3146 3145 function bp_get_avatar_delete_link() { 3146 $profile_slug = bp_get_profile_slug(); 3147 $url = wp_nonce_url( 3148 bp_displayed_user_url( 3149 array( 3150 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ), 3151 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_change_avatar', 'change-avatar' ), 3152 'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_delete_avatar', 'delete-avatar' ) ), 3153 ) 3154 ), 3155 'bp_delete_avatar_link' 3156 ); 3147 3157 3148 3158 /** … … 3151 3161 * @since 1.1.0 3152 3162 * 3153 * @param string $ valueNonced URL used for deleting an avatar.3154 */ 3155 return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_profile_slug() . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ));3163 * @param string $url Nonced URL used for deleting an avatar. 3164 */ 3165 return apply_filters( 'bp_get_avatar_delete_link', $url ); 3156 3166 } 3157 3167
Note: See TracChangeset
for help on using the changeset viewer.