Changeset 13433
- Timestamp:
- 03/07/2023 04:28:08 AM (19 months ago)
- Location:
- trunk
- Files:
-
- 60 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/actions/feeds.php
r12907 r13433 176 176 'description' => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ), 177 177 'activity_args' => array( 178 'search_terms' => '@' . bp_ core_get_username( bp_displayed_user_id() )178 'search_terms' => '@' . bp_members_get_user_slug( bp_displayed_user_id() ) 179 179 ) 180 180 ) ); -
trunk/src/bp-activity/bp-activity-filters.php
r13108 r13433 265 265 // Linkify the mentions with the username. 266 266 foreach ( (array) $usernames as $user_id => $username ) { 267 $content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_ core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content );267 $content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_members_get_user_url( $user_id ) . "' rel='nofollow'>@$username</a>", $content ); 268 268 } 269 269 … … 306 306 // Replace @mention text with userlinks. 307 307 foreach( (array) $usernames as $user_id => $username ) { 308 $activity->content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_ core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $activity->content );308 $activity->content = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bp_members_get_user_url( $user_id ) . "' rel='nofollow'>@$username</a>", $activity->content ); 309 309 } 310 310 -
trunk/src/bp-activity/bp-activity-notifications.php
r12893 r13433 412 412 <?php 413 413 /* translators: %s: the displayed user username */ 414 printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_ core_get_username( bp_displayed_user_id() ) );414 printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_members_get_user_slug( bp_displayed_user_id() ) ); 415 415 ?> 416 416 </td> -
trunk/src/bp-activity/bp-activity-template.php
r13409 r13433 1007 1007 $link = $activities_template->activity->primary_link; 1008 1008 } else { 1009 $link = bp_ core_get_user_domain( $activities_template->activity->user_id, $activities_template->activity->user_nicename, $activities_template->activity->user_login);1009 $link = bp_members_get_user_url( $activities_template->activity->user_id ); 1010 1010 } 1011 1011 … … 1540 1540 if ( in_array( $activity_type, array( 'new_avatar', 'new_member', 'friendship_created', 'updated_profile' ), true ) ) { 1541 1541 $generated_content->user_url = array( 1542 'value' => bp_ core_get_user_domain( $user_id ),1542 'value' => bp_members_get_user_url( $user_id ), 1543 1543 'sanitize_callback' => 'esc_url', 1544 1544 ); … … 2255 2255 */ 2256 2256 function bp_get_activity_comment_user_link() { 2257 $user_link = bp_ core_get_user_domain( bp_get_activity_comment_user_id() );2257 $user_link = bp_members_get_user_url( bp_get_activity_comment_user_id() ); 2258 2258 2259 2259 /** … … 3653 3653 3654 3654 // Get profile link for this user. 3655 $profile_link = bp_ core_get_user_domain( $user_id );3655 $profile_link = bp_members_get_user_url( $user_id ); 3656 3656 3657 3657 // Get avatar for this user. -
trunk/src/bp-activity/classes/class-bp-activity-oembed-extension.php
r13241 r13433 138 138 'title' => __( 'Activity', 'buddypress' ), 139 139 'author_name' => bp_core_get_user_displayname( $activity->user_id ), 140 'author_url' => bp_ core_get_user_domain( $activity->user_id ),140 'author_url' => bp_members_get_user_url( $activity->user_id ), 141 141 142 142 // Custom identifier. -
trunk/src/bp-activity/screens/permalink.php
r12527 r13433 36 36 37 37 // Do not redirect at default. 38 $redirect = false; 38 $redirect = false; 39 $path_chunks = array( 40 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 41 'single_item_action' => $activity->id, 42 ); 39 43 40 44 // Redirect based on the type of activity. … … 43 47 // Activity is a user update. 44 48 if ( ! empty( $activity->user_id ) ) { 45 $redirect = bp_ core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';49 $redirect = bp_members_get_user_url( $activity->user_id, $path_chunks ); 46 50 47 51 // Activity is something else. … … 56 60 // Set redirect to users' activity stream. 57 61 } elseif ( ! empty( $activity->user_id ) ) { 58 $redirect = bp_ core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';62 $redirect = bp_members_get_user_url( $activity->user_id, $path_chunks ); 59 63 } 60 64 -
trunk/src/bp-blogs/bp-blogs-activity.php
r13419 r13433 785 785 'comment_author' => bp_core_get_user_displayname( $params['user_id'] ), 786 786 'comment_author_email' => $user->user_email, 787 'comment_author_url' => bp_ core_get_user_domain( $params['user_id'], $user->user_nicename, $user->user_login),787 'comment_author_url' => bp_members_get_user_url( $params['user_id'] ), 788 788 'comment_content' => $params['content'], 789 789 'comment_type' => '', // Could be interesting to add 'BuddyPress' here... -
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13431 r13433 1311 1311 1312 1312 // Create a "View" link. 1313 $url = bp_ core_get_user_domain( $user_id );1313 $url = bp_members_get_user_url( $user_id ); 1314 1314 $actions['view'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $url ), esc_html__( 'View', 'buddypress' ) ); 1315 1315 -
trunk/src/bp-core/bp-core-catchuri.php
r13162 r13433 591 591 $user = wp_get_current_user(); 592 592 593 return bp_ core_get_username( $user->ID, $user->user_nicename, $user->user_login);593 return bp_members_get_user_slug( $user->ID ); 594 594 } 595 595 add_filter( 'bp_core_set_uri_globals_member_slug', 'bp_core_members_shortlink_redirector' ); -
trunk/src/bp-core/bp-core-filters.php
r13395 r13433 292 292 293 293 foreach( (array) $comments as $comment ) { 294 if ( $comment->user_id ) 294 if ( $comment->user_id ) { 295 295 $user_ids[] = $comment->user_id; 296 } 297 298 if ( empty( $user_ids ) ) 296 } 297 } 298 299 if ( empty( $user_ids ) ) { 299 300 return $comments; 301 } 300 302 301 303 $user_ids = implode( ',', wp_parse_id_list( $user_ids ) ); 302 304 303 if ( ! $userdata = $wpdb->get_results( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) )305 if ( ! $userdata = $wpdb->get_results( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) ) { 304 306 return $comments; 305 306 foreach( (array) $userdata as $user ) 307 $users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login ); 307 } 308 309 foreach( (array) $userdata as $user ) { 310 $users[$user->user_id] = bp_members_get_user_url( $user->user_id ); 311 } 308 312 309 313 foreach( (array) $comments as $i => $comment ) { 310 if ( ! empty( $comment->user_id ) ) {311 if ( ! empty( $users[$comment->user_id] ) )314 if ( ! empty( $comment->user_id ) ) { 315 if ( ! empty( $users[$comment->user_id] ) ) { 312 316 $comments[$i]->comment_author_url = $users[$comment->user_id]; 317 } 313 318 } 314 319 } … … 1233 1238 $tokens['unsubscribe'] = esc_url( sprintf( 1234 1239 '%s%s/notifications/', 1235 bp_ core_get_user_domain( $user_obj->ID ),1240 bp_members_get_user_url( $user_obj->ID ), 1236 1241 bp_get_settings_slug() 1237 1242 ) ); -
trunk/src/bp-core/bp-core-functions.php
r13432 r13433 4336 4336 4337 4337 if ( bp_is_active( 'settings' ) ) { 4338 $redirect_to = sprintf( 4339 '%s%s/notifications/', 4340 bp_core_get_user_domain( get_current_user_id() ), 4341 bp_get_settings_slug() 4338 $redirect_to = bp_members_get_user_url( 4339 get_current_user_id(), 4340 array( 4341 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ), 4342 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_settings_notifications', 'notifications' ), 4343 ) 4342 4344 ); 4343 4345 } else { 4344 $redirect_to = bp_ core_get_user_domain( get_current_user_id() );4346 $redirect_to = bp_members_get_user_url( get_current_user_id() ); 4345 4347 } 4346 4348 … … 4368 4370 $redirect_to = sprintf( 4369 4371 '%s%s/notifications/', 4370 bp_ core_get_user_domain( $raw_user_id ),4372 bp_members_get_user_url( $raw_user_id ), 4371 4373 bp_get_settings_slug() 4372 4374 ); 4373 4375 } else { 4374 $redirect_to = bp_ core_get_user_domain( $raw_user_id );4376 $redirect_to = bp_members_get_user_url( $raw_user_id ); 4375 4377 } 4376 4378 … … 4393 4395 // Template notices are only displayed on BP pages. 4394 4396 bp_core_add_message( $message ); 4395 bp_core_redirect( bp_ core_get_user_domain( $raw_user_id ) );4397 bp_core_redirect( bp_members_get_user_url( $raw_user_id ) ); 4396 4398 4397 4399 exit; -
trunk/src/bp-core/bp-core-rewrites.php
r13432 r13433 73 73 * 74 74 * @param string $component_id The BuddyPress component's ID. 75 * @param string $rewrite_id The view rewrite ID. 76 * @param string $default_slug The view default slug. 75 * @param string $rewrite_id The view rewrite ID, used to find the custom slugs. 76 * Eg: `member_profile_edit` will try to find the xProfile edit's slug. 77 * @param string $default_slug The view default slug, used as a fallback. 77 78 * @return string The slug to use for the view belonging to the requested component. 78 79 */ … … 84 85 return $slug; 85 86 } 87 88 // Make sure a `bp_` prefix is used. 89 $rewrite_id = 'bp_' . str_replace( 'bp_', '', sanitize_key( $rewrite_id ) ); 86 90 87 91 $custom_slugs = (array) $directory_pages->{$component_id}->custom_slugs; -
trunk/src/bp-core/classes/class-bp-core-user.php
r12791 r13433 156 156 $full_name_field_name = bp_xprofile_fullname_field_name(); 157 157 158 $this->user_url = bp_ core_get_user_domain( $this->id, $this->profile_data['user_nicename'], $this->profile_data['user_login']);158 $this->user_url = bp_members_get_user_url( $this->id ); 159 159 $this->fullname = esc_attr( $this->profile_data[$full_name_field_name]['field_data'] ); 160 160 $this->user_link = "<a href='{$this->user_url}'>{$this->fullname}</a>"; 161 161 $this->email = esc_attr( $this->profile_data['user_email'] ); 162 162 } else { 163 $this->user_url = bp_ core_get_user_domain( $this->id );163 $this->user_url = bp_members_get_user_url( $this->id ); 164 164 $this->user_link = bp_core_get_userlink( $this->id ); 165 165 $this->fullname = esc_attr( bp_core_get_user_displayname( $this->id ) ); -
trunk/src/bp-core/classes/class-bp-optouts-list-table.php
r13225 r13433 325 325 return; 326 326 } 327 $user_link = bp_ core_get_user_domain( $optout->user_id );327 $user_link = bp_members_get_user_url( $optout->user_id ); 328 328 echo $avatar . sprintf( '<strong><a href="%1$s" class="edit">%2$s</a></strong><br/>', esc_url( $user_link ), esc_html( $inviter->user_login ) ); 329 329 } -
trunk/src/bp-core/deprecated/12.0.php
r13432 r13433 158 158 _deprecated_function( __FUNCTION__, '12.0.0' ); 159 159 } 160 161 /** 162 * Return the username for a user based on their user id. 163 * 164 * This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE, 165 * so it will return the user_login or user_nicename as appropriate. 166 * 167 * @since 1.0.0 168 * @deprecated 12.0.0 169 * 170 * @param int $user_id User ID to check. 171 * @param string|bool $user_nicename Optional. user_nicename of user being checked. 172 * @param string|bool $user_login Optional. user_login of user being checked. 173 * @return string The username of the matched user or an empty string if no user is found. 174 */ 175 function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false ) { 176 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_slug()' ); 177 178 if ( ! $user_id ) { 179 $value = $user_nicename; 180 $field = 'slug'; 181 182 if ( ! $user_nicename ) { 183 $value = $user_login; 184 $field = 'login'; 185 } 186 187 $user = get_user_by( $field, $value ); 188 189 if ( $user instanceof WP_User ) { 190 $user_id = (int) $user->ID; 191 } 192 } 193 194 $username = bp_members_get_user_slug( $user_id ); 195 196 /** 197 * Filters the username based on originally provided user ID. 198 * 199 * @since 1.0.1 200 * @deprecated 12.0.0 201 * 202 * @param string $username Username determined by user ID. 203 */ 204 return apply_filters_deprecated( 'bp_core_get_username', array( $username ), '12.0.0', 'bp_members_get_user_slug' ); 205 } 206 207 /** 208 * Return the domain for the passed user: e.g. http://example.com/members/andy/. 209 * 210 * @since 1.0.0 211 * @deprecated 12.0.0 212 * 213 * @param int $user_id The ID of the user. 214 * @param string|bool $user_nicename Optional. user_nicename of the user. 215 * @param string|bool $user_login Optional. user_login of the user. 216 * @return string 217 */ 218 function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) { 219 _deprecated_function( __FUNCTION__, '12.0.0', 'bp_members_get_user_url()' ); 220 221 if ( empty( $user_id ) ) { 222 return; 223 } 224 225 $domain = bp_members_get_user_url( $user_id ); 226 227 // Don't use this filter. Subject to removal in a future release. 228 // Use the 'bp_core_get_user_domain' filter instead. 229 $domain = apply_filters_deprecated( 'bp_core_get_user_domain_pre_cache', array( $domain, $user_id, $user_nicename, $user_login), '12.0.0' ); 230 231 /** 232 * Filters the domain for the passed user. 233 * 234 * @since 1.0.1 235 * @deprecated 12.0.0 236 * 237 * @param string $domain Domain for the passed user. 238 * @param int $user_id ID of the passed user. 239 * @param string $user_nicename User nicename of the passed user. 240 * @param string $user_login User login of the passed user. 241 */ 242 return apply_filters_deprecated( 'bp_core_get_user_domain', array( $domain, $user_id, $user_nicename, $user_login), '12.0.0', 'bp_members_get_user_url' ); 243 } -
trunk/src/bp-friends/bp-friends-blocks.php
r13296 r13433 111 111 $widget_id = uniqid( 'friends-list-' ); 112 112 113 $link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_friends_slug() ); 113 $link = bp_members_get_user_url( 114 $user_id, 115 array( 116 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 117 ) 118 ); 114 119 115 120 /* translators: %s: member name */ … … 190 195 'php', 191 196 array( 192 'data.link' => bp_ core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login),197 'data.link' => bp_members_get_user_url( $user->ID ), 193 198 'data.name' => $user->display_name, 194 199 'data.avatar_urls.thumb' => bp_core_fetch_avatar( -
trunk/src/bp-friends/bp-friends-functions.php
r13395 r13433 878 878 $args = array( 879 879 'tokens' => array( 880 'friend-requests.url' => esc_url( bp_core_get_user_domain( $friend_id ) . bp_get_friends_slug() . '/requests/' ), 880 'friend-requests.url' => esc_url( 881 bp_members_get_user_url( 882 $friend_id, 883 array( 884 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 885 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_friends_requests', 'requests' ), 886 ) 887 ) 888 ), 881 889 'friend.id' => $friend_id, 882 890 'friendship.id' => $friendship_id, 883 891 'initiator.id' => $initiator_id, 884 'initiator.url' => esc_url( bp_ core_get_user_domain( $initiator_id ) ),892 'initiator.url' => esc_url( bp_members_get_user_url( $initiator_id ) ), 885 893 'initiator.name' => bp_core_get_user_displayname( $initiator_id ), 886 894 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), … … 916 924 'tokens' => array( 917 925 'friend.id' => $friend_id, 918 'friendship.url' => esc_url( bp_ core_get_user_domain( $friend_id ) ),926 'friendship.url' => esc_url( bp_members_get_user_url( $friend_id ) ), 919 927 'friend.name' => bp_core_get_user_displayname( $friend_id ), 920 928 'friendship.id' => $friendship_id, -
trunk/src/bp-friends/bp-friends-template.php
r13409 r13433 102 102 103 103 <li> 104 <a href="<?php echo bp_ core_get_user_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>104 <a href="<?php echo bp_members_get_user_url( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a> 105 105 <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5> 106 106 </li> … … 154 154 155 155 <li> 156 <a href="<?php echo bp_ core_get_user_domain( $user_ids['users'][$i]->id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) ) ?></a>156 <a href="<?php echo bp_members_get_user_url( $user_ids['users'][$i]->id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) ) ?></a> 157 157 <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->id ) ?></h5> 158 158 -
trunk/src/bp-groups/bp-groups-admin.php
r13372 r13433 1034 1034 1035 1035 <td class="uname-column"> 1036 <a style="float: left;" href="<?php echo bp_ core_get_user_domain( $type_user->ID ); ?>"><?php echo bp_core_fetch_avatar( array(1036 <a style="float: left;" href="<?php echo bp_members_get_user_url( $type_user->ID ); ?>"><?php echo bp_core_fetch_avatar( array( 1037 1037 'item_id' => $type_user->ID, 1038 1038 'width' => '32', -
trunk/src/bp-groups/bp-groups-notifications.php
r13293 r13433 169 169 'group.id' => $group_id, 170 170 'group-requests.url' => esc_url( bp_get_group_permalink( $group ) . 'admin/membership-requests' ), 171 'profile.url' => esc_url( bp_ core_get_user_domain( $requesting_user_id ) ),171 'profile.url' => esc_url( bp_members_get_user_url( $requesting_user_id ) ), 172 172 'requesting-user.id' => $requesting_user_id, 173 173 'requesting-user.name' => bp_core_get_user_displayname( $requesting_user_id ), … … 337 337 } 338 338 339 $invited_link = bp_core_get_user_domain( $invited_user_id ) . bp_get_groups_slug(); 339 $invited_link = bp_members_get_user_url( 340 $invited_user_id, 341 array( 342 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ), 343 ) 344 ); 340 345 341 346 $unsubscribe_args = array( … … 360 365 'group.name' => $group->name, 361 366 'inviter.name' => bp_core_get_userlink( $inviter_user_id, true, false ), 362 'inviter.url' => bp_ core_get_user_domain( $inviter_user_id ),367 'inviter.url' => bp_members_get_user_url( $inviter_user_id ), 363 368 'inviter.id' => $inviter_user_id, 364 369 'invites.url' => esc_url( $invited_link . '/invites/' ), … … 1252 1257 'group.name' => $group->name, 1253 1258 'group.url' => esc_url( bp_get_group_permalink( $group ) ), 1254 'leave-group.url' => esc_url( bp_core_get_user_domain( $user_id ) . bp_get_groups_slug() ), 1259 'leave-group.url' => esc_url( 1260 bp_members_get_user_url( 1261 $user_id, 1262 array( 1263 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ), 1264 ) 1265 ) 1266 ), 1255 1267 ), 1256 1268 ); -
trunk/src/bp-groups/bp-groups-template.php
r13409 r13433 1639 1639 * @param BP_Groups_Group $group The group object. 1640 1640 */ 1641 return apply_filters( 'bp_get_group_creator_permalink', bp_ core_get_user_domain( $group->creator_id ), $group );1641 return apply_filters( 'bp_get_group_creator_permalink', bp_members_get_user_url( $group->creator_id ), $group ); 1642 1642 } 1643 1643 … … 1797 1797 <li> 1798 1798 <a 1799 href="<?php echo esc_url( bp_ core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login) ); ?>"1799 href="<?php echo esc_url( bp_members_get_user_url( $admin->user_id ) ); ?>" 1800 1800 class="bp-tooltip" 1801 1801 data-bp-tooltip="<?php printf( ( '%s' ), bp_core_get_user_displayname( $admin->user_id ) ); ?>" … … 1844 1844 <li> 1845 1845 <a 1846 href="<?php echo esc_url( bp_ core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login) ); ?>"1846 href="<?php echo esc_url( bp_members_get_user_url( $mod->user_id ) ); ?>" 1847 1847 class="bp-tooltip" 1848 1848 data-bp-tooltip="<?php printf( ( '%s' ), bp_core_get_user_displayname( $mod->user_id ) ); ?>"> … … 4273 4273 * @param string $value URL for the current user. 4274 4274 */ 4275 return apply_filters( 'bp_get_group_member_url', bp_ core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login) );4275 return apply_filters( 'bp_get_group_member_url', bp_members_get_user_url( $members_template->member->user_id ) ); 4276 4276 } 4277 4277 … … 4297 4297 * @param string $value HTML link for the current user. 4298 4298 */ 4299 return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_ core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login) . '">' . $members_template->member->display_name . '</a>' );4299 return apply_filters( 'bp_get_group_member_link', '<a href="' . bp_members_get_user_url( $members_template->member->user_id ) . '">' . $members_template->member->display_name . '</a>' ); 4300 4300 } 4301 4301 … … 4321 4321 * @param string $value Domain for the current user. 4322 4322 */ 4323 return apply_filters( 'bp_get_group_member_domain', bp_ core_get_user_domain( $members_template->member->user_id, $members_template->member->user_nicename, $members_template->member->user_login) );4323 return apply_filters( 'bp_get_group_member_domain', bp_members_get_user_url( $members_template->member->user_id ) ); 4324 4324 } 4325 4325 -
trunk/src/bp-groups/classes/class-bp-groups-invite-template.php
r13399 r13433 293 293 294 294 $this->invite->user->email = $this->invite->user->user_email; 295 $this->invite->user->user_url = bp_ core_get_user_domain( $user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);295 $this->invite->user->user_url = bp_members_get_user_url( $user_id ); 296 296 $this->invite->user->user_link = "<a href='{$this->invite->user->user_url}'>{$this->invite->user->fullname}</a>"; 297 297 -
trunk/src/bp-members/actions/random.php
r11927 r13433 18 18 19 19 $user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) ); 20 bp_core_redirect( bp_ core_get_user_domain( $user['users'][0]->id ) );20 bp_core_redirect( bp_members_get_user_url( $user['users'][0]->id ) ); 21 21 } 22 22 add_action( 'bp_actions', 'bp_core_get_random_member' ); -
trunk/src/bp-members/bp-members-blocks.php
r13296 r13433 44 44 45 45 // Mention variables. 46 $username = bp_ core_get_username( $member_id );46 $username = bp_members_get_user_slug( $member_id ); 47 47 $at_mention = ''; 48 48 … … 58 58 // Member name variables. 59 59 $display_name = bp_core_get_user_displayname( $member_id ); 60 $member_link = bp_ core_get_user_domain( $member_id );60 $member_link = bp_members_get_user_url( $member_id ); 61 61 62 62 // Member action button. … … 230 230 231 231 // Get Member link. 232 $member_link = bp_ core_get_user_domain( $member->ID );232 $member_link = bp_members_get_user_url( $member->ID ); 233 233 234 234 // Set the Avatar output. … … 483 483 'php', 484 484 array( 485 'data.link' => bp_ core_get_user_domain( $user->ID, $user->user_nicename, $user->user_login),485 'data.link' => bp_members_get_user_url( $user->ID ), 486 486 'data.name' => $user->display_name, 487 487 'data.avatar_urls.thumb' => bp_core_fetch_avatar( … … 633 633 </a> 634 634 </div>', 635 esc_url( bp_ core_get_user_domain( $member->ID, $member->user_nicename, $member->user_login) ),635 esc_url( bp_members_get_user_url( $member->ID ) ), 636 636 esc_html( $member->display_name ), 637 637 bp_core_fetch_avatar( -
trunk/src/bp-members/bp-members-filters.php
r13105 r13433 109 109 // If xprofile is active, use profile domain link. 110 110 if ( ! is_admin() && bp_is_active( 'xprofile' ) ) { 111 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() . '/edit' ); 111 $profile_link = bp_members_get_user_url( 112 $user_id, 113 array( 114 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 115 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_profile_edit', 'edit' ), 116 ) 117 ); 112 118 113 119 } else { -
trunk/src/bp-members/bp-members-functions.php
r13432 r13433 140 140 141 141 /** 142 * Return the domain for the passed user: e.g. http://example.com/members/andy/. 143 * 144 * @since 1.0.0 145 * 146 * @param int $user_id The ID of the user. 147 * @param string|bool $user_nicename Optional. user_nicename of the user. 148 * @param string|bool $user_login Optional. user_login of the user. 149 * @return string 150 */ 151 function bp_core_get_user_domain( $user_id = 0, $user_nicename = false, $user_login = false ) { 152 153 if ( empty( $user_id ) ) { 154 return; 155 } 156 157 $username = bp_core_get_username( $user_id, $user_nicename, $user_login ); 158 159 if ( bp_is_username_compatibility_mode() ) { 160 $username = rawurlencode( $username ); 161 } 162 163 $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username; 164 $domain = trailingslashit( bp_get_root_domain() . '/' . $after_domain ); 165 166 // Don't use this filter. Subject to removal in a future release. 167 // Use the 'bp_core_get_user_domain' filter instead. 168 $domain = apply_filters( 'bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login ); 142 * Return the Mmbers single item's URL. 143 * 144 * @since 12.0.0 145 * 146 * @param integer $user_id The user ID. 147 * @param array $action { 148 * An array of arguments. Optional. 149 * 150 * @type string $single_item_component The component slug the action is relative to. 151 * @type string $single_item_action The slug of the action to perform. 152 * @type array $single_item_action_variables An array of additional informations about the action to perform. 153 * } 154 * @return string The URL built for the BP Rewrites URL parser. 155 */ 156 function bp_members_get_user_url( $user_id = 0, $path_chunks = array() ) { 157 $url = ''; 158 $slug = bp_members_get_user_slug( $user_id ); 159 160 if ( $slug ) { 161 if ( bp_is_username_compatibility_mode() ) { 162 $slug = rawurlencode( $slug ); 163 } 164 165 $supported_chunks = array_fill_keys( array( 'single_item_component', 'single_item_action', 'single_item_action_variables' ), true ); 166 $path_chunks = bp_parse_args( 167 array_intersect_key( $path_chunks, $supported_chunks ), 168 array( 169 'component_id' => 'members', 170 'single_item' => $slug, 171 ) 172 ); 173 174 $url = bp_rewrites_get_url( $path_chunks ); 175 } 169 176 170 177 /** … … 172 179 * 173 180 * @since 1.0.1 181 * @deprecated 12.0.0 174 182 * 175 183 * @param string $domain Domain for the passed user. … … 178 186 * @param string $user_login User login of the passed user. 179 187 */ 180 return apply_filters( 'bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login ); 188 $url = apply_filters_deprecated( 'bp_core_get_user_domain', array( $url, $user_id, false, false ), '12.0.0', 'bp_members_get_user_url' ); 189 190 /** 191 * Filters the domain for the passed user. 192 * 193 * @since 12.0.0 194 * 195 * @param string $url The user url. 196 * @param integer $user_id The user ID. 197 * @param string $slug The user slug. 198 * @param array $path_chunks { 199 * An array of arguments. Optional. 200 * 201 * @type string $single_item_component The component slug the action is relative to. 202 * @type string $single_item_action The slug of the action to perform. 203 * @type array $single_item_action_variables An array of additional informations about the action to perform. 204 * } 205 */ 206 return apply_filters( 'bp_members_get_user_url', $url, $user_id, $slug, $path_chunks ); 181 207 } 182 208 … … 274 300 275 301 /** 276 * Return the username for a user based on their user id. 277 * 278 * This function is sensitive to the BP_ENABLE_USERNAME_COMPATIBILITY_MODE, 279 * so it will return the user_login or user_nicename as appropriate. 280 * 281 * @since 1.0.0 282 * 283 * @param int $user_id User ID to check. 284 * @param string|bool $user_nicename Optional. user_nicename of user being checked. 285 * @param string|bool $user_login Optional. user_login of user being checked. 286 * @return string The username of the matched user or an empty string if no user is found. 287 */ 288 function bp_core_get_username( $user_id = 0, $user_nicename = false, $user_login = false ) { 289 290 if ( ! $user_nicename && ! $user_login ) { 291 // Pull an audible and maybe use the login over the nicename. 292 if ( bp_is_username_compatibility_mode() ) { 293 $username = get_the_author_meta( 'login', $user_id ); 294 } else { 295 $username = get_the_author_meta( 'nicename', $user_id ); 296 } 302 * Returns the members single item (member) slug. 303 * 304 * @since 12.0.0 305 * 306 * @param integer $user_id The User ID. 307 * @return string The member slug. 308 */ 309 function bp_members_get_user_slug( $user_id = 0 ) { 310 $bp = buddypress(); 311 $lug = ''; 312 313 $prop = 'user_nicename'; 314 if ( bp_is_username_compatibility_mode() ) { 315 $prop = 'user_login'; 316 } 317 318 if ( (int) bp_loggedin_user_id() === (int) $user_id ) { 319 $slug = isset( $bp->loggedin_user->userdata->{$prop} ) ? $bp->loggedin_user->userdata->{$prop} : null; 320 } elseif ( (int) bp_displayed_user_id() === (int) $user_id ) { 321 $slug = isset( $bp->displayed_user->userdata->{$prop} ) ? $bp->displayed_user->userdata->{$prop} : null; 297 322 } else { 298 $username = bp_is_username_compatibility_mode() ? $user_login : $user_nicename; 323 $user = get_user_by( 'id', $user_id ); 324 325 if ( $user instanceof WP_User ) { 326 $slug = $user->{$prop}; 327 } 299 328 } 300 329 … … 303 332 * 304 333 * @since 1.0.1 305 * 306 * @param string $username Username determined by user ID. 307 */ 308 return apply_filters( 'bp_core_get_username', $username ); 334 * @deprecated 12.0.0 335 * 336 * @param string $slug Username determined by user ID. 337 */ 338 $slug = apply_filters_deprecated( 'bp_core_get_username', array( $slug ), '12.0.0', 'bp_members_get_user_slug' ); 339 340 /** 341 * Filter here to edit the user's slug. 342 * 343 * @since 12.0.0 344 * 345 * @param string $slug The user's slug. 346 * @param integer $user_id The user ID. 347 */ 348 return apply_filters( 'bp_members_get_user_slug', $slug, $user_id ); 309 349 } 310 350 … … 381 421 } 382 422 383 if ( !$url = bp_ core_get_user_domain( $user_id ) ) {423 if ( !$url = bp_members_get_user_url( $user_id ) ) { 384 424 return false; 385 425 } … … 3316 3356 } 3317 3357 3318 $profile_url = bp_ core_get_user_domain( $user_id );3358 $profile_url = bp_members_get_user_url( $user_id ); 3319 3359 3320 3360 /** -
trunk/src/bp-members/bp-members-notifications.php
r13185 r13433 48 48 } 49 49 } else { 50 $link = add_query_arg( 'welcome', 1, bp_ core_get_user_domain( $item_id ) );50 $link = add_query_arg( 'welcome', 1, bp_members_get_user_url( $item_id ) ); 51 51 $amount = 'single'; 52 52 -
trunk/src/bp-members/bp-members-template.php
r13432 r13433 902 902 global $members_template; 903 903 904 $permalink = bp_core_get_user_domain( 905 $members_template->member->id, 906 $members_template->member->user_nicename, 907 $members_template->member->user_login 908 ); 904 $permalink = bp_members_get_user_url( $members_template->member->id ); 909 905 910 906 /** … … 2050 2046 2051 2047 if ( bp_displayed_user_id() ) { 2052 $username = bp_ core_get_username( bp_displayed_user_id(), $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login);2048 $username = bp_members_get_user_slug( bp_displayed_user_id() ); 2053 2049 } else { 2054 2050 $username = ''; … … 2084 2080 2085 2081 if ( bp_loggedin_user_id() ) { 2086 $username = bp_ core_get_username( bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login);2082 $username = bp_members_get_user_slug( bp_loggedin_user_id() ); 2087 2083 } else { 2088 2084 $username = ''; … … 3572 3568 $domain = bp_loggedin_user_domain(); 3573 3569 } else { 3574 $domain = bp_ core_get_user_domain( (int) $user_id );3570 $domain = bp_members_get_user_url( (int) $user_id ); 3575 3571 } 3576 3572 … … 3611 3607 $domain = bp_loggedin_user_domain(); 3612 3608 } else { 3613 $domain = bp_ core_get_user_domain( (int) $user_id );3609 $domain = bp_members_get_user_url( (int) $user_id ); 3614 3610 } 3615 3611 -
trunk/src/bp-members/classes/class-bp-members-admin.php
r13404 r13433 1334 1334 1335 1335 <div id="publishing-action"> 1336 <a class="button bp-view-profile" href="<?php echo esc_url( bp_ core_get_user_domain( $user->ID ) ); ?>" target="_blank"><?php esc_html_e( 'View Profile', 'buddypress' ); ?></a>1336 <a class="button bp-view-profile" href="<?php echo esc_url( bp_members_get_user_url( $user->ID ) ); ?>" target="_blank"><?php esc_html_e( 'View Profile', 'buddypress' ); ?></a> 1337 1337 <?php submit_button( esc_html__( 'Update Profile', 'buddypress' ), 'primary', 'save', false ); ?> 1338 1338 </div> -
trunk/src/bp-members/classes/class-bp-members-component.php
r13432 r13433 229 229 230 230 // The domain for the user currently logged in. eg: http://example.com/members/andy. 231 $bp->loggedin_user->domain = bp_ core_get_user_domain( bp_loggedin_user_id() );231 $bp->loggedin_user->domain = bp_members_get_user_url( bp_loggedin_user_id() ); 232 232 233 233 /** Displayed user *************************************************** … … 241 241 242 242 // The domain for the user currently being displayed. 243 $bp->displayed_user->domain = bp_ core_get_user_domain( bp_displayed_user_id() );243 $bp->displayed_user->domain = bp_members_get_user_url( bp_displayed_user_id() ); 244 244 245 245 // If A user is displayed, check if there is a front template -
trunk/src/bp-members/classes/class-bp-members-invitation-manager.php
r13293 r13433 74 74 'tokens' => array( 75 75 'inviter.name' => bp_core_get_userlink( $invitation->inviter_id, true, false ), 76 'inviter.url' => bp_ core_get_user_domain( $invitation->inviter_id ),76 'inviter.url' => bp_members_get_user_url( $invitation->inviter_id ), 77 77 'inviter.id' => $invitation->inviter_id, 78 78 'invite.accept_url' => esc_url( $invite_url ), -
trunk/src/bp-members/classes/class-bp-members-invitations-list-table.php
r13225 r13433 426 426 } 427 427 428 $user_link = bp_ core_get_user_domain( $invite->inviter_id );428 $user_link = bp_members_get_user_url( $invite->inviter_id ); 429 429 430 430 printf( '%1$s <strong><a href="%2$s" class="edit">%3$s</a></strong><br/>', $avatar, esc_url( $user_link ), esc_html( $inviter->user_login ) ); -
trunk/src/bp-messages/bp-messages-functions.php
r13395 r13433 627 627 'tokens' => array( 628 628 'usermessage' => wp_strip_all_tags( stripslashes( $message ) ), 629 'message.url' => esc_url( bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() . '/view/' . $thread_id . '/' ), 629 'message.url' => esc_url( 630 bp_members_get_user_url( 631 $recipient->user_id, 632 array( 633 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ), 634 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_messages_view', 'view' ), 635 'single_item_action_variables' => array( $thread_id ), 636 ) 637 ) 638 ), 630 639 'sender.name' => $sender_name, 631 640 'usersubject' => sanitize_text_field( stripslashes( $subject ) ), -
trunk/src/bp-messages/bp-messages-star.php
r13108 r13433 129 129 // Empty or other. 130 130 default : 131 $user_domain = bp_ core_get_user_domain( $r['user_id'] );131 $user_domain = bp_members_get_user_url( $r['user_id'] ); 132 132 break; 133 133 } -
trunk/src/bp-messages/bp-messages-template.php
r13409 r13433 338 338 } 339 339 340 $domain = bp_ core_get_user_domain( $user_id );340 $domain = bp_members_get_user_url( $user_id ); 341 341 342 342 /** … … 383 383 } 384 384 385 $domain = bp_ core_get_user_domain( $user_id );385 $domain = bp_members_get_user_url( $user_id ); 386 386 387 387 /** … … 435 435 } 436 436 437 $domain = bp_ core_get_user_domain( $user_id );437 $domain = bp_members_get_user_url( $user_id ); 438 438 439 439 // Base unread URL. … … 497 497 } 498 498 499 $domain = bp_ core_get_user_domain( $user_id );499 $domain = bp_members_get_user_url( $user_id ); 500 500 501 501 // Base read URL. … … 1484 1484 * @param string $value URL for the Private Message link in member profile headers. 1485 1485 */ 1486 return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_ core_get_username( bp_displayed_user_id() ) ) );1486 return apply_filters( 'bp_get_send_private_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_members_get_user_slug( bp_displayed_user_id() ) ) ); 1487 1487 } 1488 1488 -
trunk/src/bp-notifications/bp-notifications-template.php
r13147 r13433 63 63 $domain = bp_loggedin_user_domain(); 64 64 } else { 65 $domain = bp_ core_get_user_domain( (int) $user_id );65 $domain = bp_members_get_user_url( (int) $user_id ); 66 66 } 67 67 … … 104 104 $domain = bp_loggedin_user_domain(); 105 105 } else { 106 $domain = bp_ core_get_user_domain( (int) $user_id );106 $domain = bp_members_get_user_url( (int) $user_id ); 107 107 } 108 108 … … 144 144 $domain = bp_loggedin_user_domain(); 145 145 } else { 146 $domain = bp_ core_get_user_domain( (int) $user_id );146 $domain = bp_members_get_user_url( (int) $user_id ); 147 147 } 148 148 -
trunk/src/bp-templates/bp-nouveau/includes/activity/ajax.php
r13395 r13433 268 268 // If on a single activity redirect to user's home. 269 269 if ( ! empty( $_POST['is_single'] ) ) { 270 $response['redirect'] = bp_ core_get_user_domain( $activity->user_id );270 $response['redirect'] = bp_members_get_user_url( $activity->user_id ); 271 271 bp_core_add_message( __( 'Activity deleted successfully', 'buddypress' ) ); 272 272 } … … 666 666 // If on a single activity redirect to user's home. 667 667 if ( ! empty( $_POST['is_single'] ) ) { 668 $response['redirect'] = bp_ core_get_user_domain( $activity->user_id );668 $response['redirect'] = bp_members_get_user_url( $activity->user_id ); 669 669 bp_core_add_message( __( 'This activity has been marked as spam and is no longer visible.', 'buddypress' ) ); 670 670 } -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13302 r13433 254 254 ), 255 255 'user_link' => bp_core_get_userlink( $inviter_id, false, true ), 256 'user_name' => bp_ core_get_username( $inviter_id ),256 'user_name' => bp_members_get_user_slug( $inviter_id ), 257 257 ); 258 258 } -
trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php
r13288 r13433 368 368 ) ) ), 369 369 'user_link' => bp_core_get_userlink( $recipient->user_id, false, true ), 370 'user_name' => bp_ core_get_username( $recipient->user_id ),370 'user_name' => bp_members_get_user_slug( $recipient->user_id ), 371 371 ); 372 372 } … … 518 518 ) ) ), 519 519 'user_link' => bp_core_get_userlink( $recipient->user_id, false, true ), 520 'user_name' => bp_ core_get_username( $recipient->user_id ),520 'user_name' => bp_members_get_user_slug( $recipient->user_id ), 521 521 ); 522 522 } -
trunk/src/bp-templates/bp-nouveau/includes/template-tags.php
r13189 r13433 2268 2268 } elseif ( ! empty( $r['object'] ) && ! empty( $r['item_id'] ) ) { 2269 2269 if ( 'user' === $r['object'] ) { 2270 $url = rawurlencode( bp_ core_get_user_domain( $r['item_id'] ) );2270 $url = rawurlencode( bp_members_get_user_url( $r['item_id'] ) ); 2271 2271 2272 2272 } elseif ( 'group' === $r['object'] ) { -
trunk/src/bp-xprofile/bp-xprofile-activity.php
r13108 r13433 50 50 */ 51 51 function bp_xprofile_format_activity_action_updated_profile( $action, $activity ) { 52 53 // Note for translators: The natural phrasing in English, "Joe updated 54 // his profile", requires that we know Joe's gender, which we don't. If 55 // your language doesn't have this restriction, feel free to use a more 56 // natural translation. 57 $profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . bp_get_profile_slug() ); 52 /* 53 * Note for translators: The natural phrasing in English, "Joe updated 54 * his profile", requires that we know Joe's gender, which we don't. If 55 * your language doesn't have this restriction, feel free to use a more 56 * natural translation. 57 */ 58 $profile_link = bp_members_get_user_url( 59 $activity->user_id, 60 array( 61 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 62 ) 63 ); 58 64 59 65 /* translators: %s: user profile link */ … … 247 253 248 254 // If we've reached this point, assemble and post the activity item. 249 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_profile_slug() ); 255 $profile_link = bp_members_get_user_url( 256 $user_id, 257 array( 258 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 259 ) 260 ); 250 261 251 262 return (bool) xprofile_record_activity( array( -
trunk/tests/phpunit/includes/testcase.php
r13314 r13433 210 210 $bp->loggedin_user->fullname = bp_core_get_user_displayname( $user_id ); 211 211 $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin( $user_id ); 212 $bp->loggedin_user->domain = bp_ core_get_user_domain( $user_id );212 $bp->loggedin_user->domain = bp_members_get_user_url( $user_id ); 213 213 $bp->loggedin_user->userdata = bp_core_get_core_userdata( $user_id ); 214 214 -
trunk/tests/phpunit/testcases/activity/filters.php
r11737 r13433 21 21 22 22 $u1_mention_name = bp_activity_get_user_mentionname( $u1 ); 23 $u1_domain = bp_ core_get_user_domain( $u1 );23 $u1_domain = bp_members_get_user_url( $u1 ); 24 24 $u2_mention_name = bp_activity_get_user_mentionname( $u2 ); 25 $u2_domain = bp_ core_get_user_domain( $u2 );25 $u2_domain = bp_members_get_user_url( $u2 ); 26 26 27 27 // mentions normal text should be replaced -
trunk/tests/phpunit/testcases/activity/notifications.php
r13414 r13433 7 7 #[AllowDynamicProperties] 8 8 class BP_Tests_Activity_Notifications extends BP_UnitTestCase { 9 protected $permalink_structure = ''; 9 10 protected $current_user; 10 11 protected $u1; … … 15 16 public function set_up() { 16 17 parent::set_up(); 18 $this->permalink_structure = get_option( 'permalink_structure', '' ); 17 19 $this->current_user = get_current_user_id(); 18 20 $this->u1 = self::factory()->user->create(); … … 31 33 public function tear_down() { 32 34 $this->set_current_user( $this->current_user ); 35 $this->set_permalink_structure( $this->permalink_structure ); 36 33 37 parent::tear_down(); 34 38 … … 43 47 public function test_bp_activity_remove_screen_notifications_on_single_activity_permalink() { 44 48 $this->create_notifications(); 49 $this->set_permalink_structure( '/%postname%/' ); 45 50 46 51 $notifications = BP_Notifications_Notification::get( array( … … 52 57 53 58 // Go to the activity permalink page 54 $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); 59 $this->go_to( 60 bp_members_get_user_url( 61 $this->u1, 62 array( 63 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 64 'single_item_action' => $this->a1, 65 ) 66 ) 67 ); 55 68 56 69 $notifications = BP_Notifications_Notification::get( array( … … 68 81 public function test_bp_activity_remove_screen_notifications_on_single_activity_permalink_logged_out() { 69 82 $this->create_notifications(); 83 $this->set_permalink_structure( '/%postname%/' ); 70 84 71 85 $notifications = BP_Notifications_Notification::get( array( … … 80 94 81 95 // Go to the activity permalink page 82 $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); 96 $this->go_to( 97 bp_members_get_user_url( 98 $this->u1, 99 array( 100 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 101 'single_item_action' => $this->a1, 102 ) 103 ) 104 ); 83 105 84 106 $notifications = BP_Notifications_Notification::get( array( … … 98 120 public function test_bp_activity_remove_screen_notifications_on_single_activity_permalink_wrong_user() { 99 121 $this->create_notifications(); 122 $this->set_permalink_structure( '/%postname%/' ); 100 123 101 124 $notifications = BP_Notifications_Notification::get( array( … … 110 133 111 134 // Go to the activity permalink page 112 $this->go_to( bp_core_get_user_domain( $this->u1 ) . 'activity/' . $this->a1 ); 135 $this->go_to( 136 bp_members_get_user_url( 137 $this->u1, 138 array( 139 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 140 'single_item_action' => $this->a1, 141 ) 142 ) 143 ); 113 144 114 145 $notifications = BP_Notifications_Notification::get( array( … … 128 159 public function test_bp_activity_remove_screen_notifications_on_mentions() { 129 160 $this->create_notifications(); 161 $this->set_permalink_structure( '/%postname%/' ); 130 162 131 163 $notifications = BP_Notifications_Notification::get( array( … … 137 169 138 170 // Go to the My Activity page 139 $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); 171 $this->go_to( 172 bp_members_get_user_url( 173 $this->u1, 174 array( 175 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 176 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_mentions', 'mentions' ), 177 ) 178 ) 179 ); 140 180 141 181 $notifications = BP_Notifications_Notification::get( array( … … 153 193 public function test_bp_activity_remove_screen_notifications_on_mentions_logged_out() { 154 194 $this->create_notifications(); 195 $this->set_permalink_structure( '/%postname%/' ); 155 196 156 197 $notifications = BP_Notifications_Notification::get( array( … … 165 206 166 207 // Go to the My Activity page 167 $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); 208 $this->go_to( 209 bp_members_get_user_url( 210 $this->u1, 211 array( 212 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 213 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_mentions', 'mentions' ), 214 ) 215 ) 216 ); 168 217 169 218 $notifications = BP_Notifications_Notification::get( array( … … 184 233 public function test_bp_activity_remove_screen_notifications_on_mentions_wrong_user() { 185 234 $this->create_notifications(); 235 $this->set_permalink_structure( '/%postname%/' ); 186 236 187 237 $notifications = BP_Notifications_Notification::get( array( … … 196 246 197 247 // Go to the My Activity page 198 $this->go_to( bp_core_get_user_domain( $this->u1 ) . bp_get_activity_slug() . '/mentions/' ); 248 $this->go_to( 249 bp_members_get_user_url( 250 $this->u1, 251 array( 252 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 253 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_mentions', 'mentions' ), 254 ) 255 ) 256 ); 199 257 200 258 $notifications = BP_Notifications_Notification::get( array( … … 215 273 public function test_bp_activity_at_mention_delete_notification() { 216 274 $this->create_notifications(); 275 $this->set_permalink_structure( '/%postname%/' ); 217 276 218 277 $notifications = BP_Notifications_Notification::get( array( -
trunk/tests/phpunit/testcases/core/class-bp-button.php
r13314 r13433 6 6 */ 7 7 class BP_Tests_BP_Button extends BP_UnitTestCase { 8 protected $permalink_structure = ''; 9 10 public function set_up() { 11 parent::set_up(); 12 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 } 14 15 public function tear_down() { 16 $this->set_permalink_structure( $this->permalink_structure ); 17 18 parent::tear_down(); 19 } 20 8 21 /** 9 22 * @group block_self … … 12 25 $u = self::factory()->user->create(); 13 26 $this->set_current_user( $u ); 14 15 $this->go_to( bp_core_get_user_domain( $u ) ); 27 $this->set_permalink_structure( '/%postname%/' ); 28 29 $this->go_to( bp_members_get_user_url( $u ) ); 16 30 17 31 $b = new BP_Button( array( … … 30 44 $u1 = self::factory()->user->create(); 31 45 $this->set_current_user( $u1 ); 46 $this->set_permalink_structure( '/%postname%/' ); 32 47 33 48 $u2 = self::factory()->user->create(); 34 $this->go_to( bp_ core_get_user_domain( $u2 ) );49 $this->go_to( bp_members_get_user_url( $u2 ) ); 35 50 36 51 $b = new BP_Button( array( … … 136 151 137 152 $this->set_current_user( $u1 ); 138 $this->go_to( bp_core_get_user_domain( $u1 ) ); 153 $this->set_permalink_structure( '/%postname%/' ); 154 $this->go_to( bp_members_get_user_url( $u1 ) ); 139 155 140 156 $found = array(); -
trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php
r11737 r13433 5 5 */ 6 6 class BP_Tests_Core_Nav_BpCoreMaybeHookNewSubnavScreenFunction extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 7 19 8 20 public function test_user_has_access_true_no_callable_function() { … … 57 69 $old_current_user = get_current_user_id(); 58 70 $this->set_current_user( $u ); 59 60 $this->go_to( bp_core_get_user_domain( $u ) ); 61 62 $subnav_item = array( 63 'user_has_access' => false, 64 ); 65 66 // Just test relevant info 67 $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ); 68 $this->assertSame( 'failure', $found['status'] ); 69 $this->assertSame( bp_core_get_user_domain( $u ), $found['redirect_args']['root'] ); 71 $this->set_permalink_structure( '/%postname%/' ); 72 73 $this->go_to( bp_members_get_user_url( $u ) ); 74 75 $subnav_item = array( 76 'user_has_access' => false, 77 ); 78 79 // Just test relevant info 80 $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item ); 81 $this->assertSame( 'failure', $found['status'] ); 82 $this->assertSame( bp_members_get_user_url( $u ), $found['redirect_args']['root'] ); 70 83 71 84 $this->set_current_user( $old_current_user ); … … 77 90 $old_current_user = get_current_user_id(); 78 91 $this->set_current_user( $u1 ); 79 80 $this->go_to( bp_core_get_user_domain( $u2 ) ); 92 $this->set_permalink_structure( '/%postname%/' ); 93 94 $this->go_to( bp_members_get_user_url( $u2 ) ); 81 95 82 96 $old_bp_nav = buddypress()->bp_nav; … … 104 118 105 119 $this->assertSame( 'failure', $found['status'] ); 106 $this->assertSame( bp_ core_get_user_domain( $u2 ), $found['redirect_args']['root'] );120 $this->assertSame( bp_members_get_user_url( $u2 ), $found['redirect_args']['root'] ); 107 121 } 108 122 … … 112 126 $old_current_user = get_current_user_id(); 113 127 $this->set_current_user( $u1 ); 114 115 $this->go_to( bp_core_get_user_domain( $u2 ) ); 128 $this->set_permalink_structure( '/%postname%/' ); 129 130 $this->go_to( bp_members_get_user_url( $u2 ) ); 116 131 117 132 $old_bp_nav = buddypress()->bp_nav; … … 140 155 141 156 $this->assertSame( 'failure', $found['status'] ); 142 $this->assertSame( bp_core_get_user_domain( $u2 ) . bp_get_activity_slug() . '/', $found['redirect_args']['root'] ); 157 $this->assertSame( 158 bp_members_get_user_url( 159 $u2, 160 array( 161 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 162 ) 163 ), 164 $found['redirect_args']['root'] 165 ); 143 166 } 144 167 -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewNavItem.php
r11737 r13433 5 5 */ 6 6 class BP_Tests_Core_Nav_BpCoreNewNavItem extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 7 19 8 20 /** … … 15 27 $old_current_user = get_current_user_id(); 16 28 $this->set_current_user( $u ); 17 18 $this->go_to( bp_core_get_user_domain( $u ) ); 29 $this->set_permalink_structure( '/%postname%/' ); 30 31 $this->go_to( bp_members_get_user_url( $u ) ); 19 32 20 33 bp_core_new_nav_item( array( … … 29 42 'name' => 'Foo', 30 43 'slug' => 'foo', 31 'link' => trailingslashit( bp_core_get_user_domain( $u ) . 'foo' ), 44 'link' => bp_members_get_user_url( 45 $u, 46 array( 47 'single_item_component' => 'foo', 48 ) 49 ), 32 50 'css_id' => 'foo', 33 51 'show_for_displayed_user' => true, … … 147 165 $old_current_user = get_current_user_id(); 148 166 $this->set_current_user( $u2 ); 149 150 $this->go_to( bp_core_get_user_domain( $u ) ); 167 $this->set_permalink_structure( '/%postname%/' ); 168 169 $this->go_to( bp_members_get_user_url( $u ) ); 151 170 152 171 $expected = array( … … 182 201 $old_current_user = get_current_user_id(); 183 202 $this->set_current_user( $u2 ); 184 185 $this->go_to( bp_core_get_user_domain( $u ) ); 203 $this->set_permalink_structure( '/%postname%/' ); 204 205 $this->go_to( bp_members_get_user_url( $u ) ); 186 206 187 207 bp_core_new_nav_item( array( -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewSubnavItem.php
r12195 r13433 16 16 $this->set_current_user( $u ); 17 17 18 $user_domain = bp_ core_get_user_domain( $u );18 $user_domain = bp_members_get_user_url( $u ); 19 19 20 20 $this->go_to( $user_domain ); … … 345 345 $this->set_current_user( $u ); 346 346 347 $user_domain = bp_ core_get_user_domain( $u );347 $user_domain = bp_members_get_user_url( $u ); 348 348 349 349 // Register a subnav on 'bp_setup_nav' hook early (at priority zero). -
trunk/tests/phpunit/testcases/core/nav/bpGetNavMenuItems.php
r11737 r13433 6 6 */ 7 7 class BP_Tests_Core_Nav_BpGetNavMenuItems extends BP_UnitTestCase { 8 protected $permalink_structure = ''; 9 10 public function set_up() { 11 parent::set_up(); 12 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 } 14 15 public function tear_down() { 16 $this->set_permalink_structure( $this->permalink_structure ); 17 18 parent::tear_down(); 19 } 20 8 21 /** 9 22 * @ticket BP7110 … … 13 26 14 27 $this->set_current_user( $users[0] ); 15 $user_1_domain = bp_core_get_user_domain( $users[1] ); 28 $this->set_permalink_structure( '/%postname%/' ); 29 30 $user_1_domain = bp_members_get_user_url( $users[1] ); 16 31 $this->go_to( $user_1_domain ); 17 32 … … 37 52 38 53 $this->set_current_user( 0 ); 39 $user_domain = bp_core_get_user_domain( $user ); 54 $this->set_permalink_structure( '/%postname%/' ); 55 56 $user_domain = bp_members_get_user_url( $user ); 40 57 $this->go_to( $user_domain ); 41 58 -
trunk/tests/phpunit/testcases/core/template/bpUserHasAccess.php
r11737 r13433 5 5 */ 6 6 class BP_Tests_Core_Template_BpUserHasAccess extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 19 7 20 public function test_should_return_true_for_bp_moderate_user() { 8 21 $users = self::factory()->user->create_many( 2 ); … … 10 23 $this->grant_bp_moderate( $users[0] ); 11 24 $this->set_current_user( $users[0] ); 25 $this->set_permalink_structure( '/%postname%/' ); 12 26 13 $this->go_to( bp_ core_get_user_domain( $users[1] ) );27 $this->go_to( bp_members_get_user_url( $users[1] ) ); 14 28 15 29 $this->assertTrue( bp_user_has_access( $users[0] ) ); … … 20 34 21 35 $this->set_current_user( $users[0] ); 36 $this->set_permalink_structure( '/%postname%/' ); 22 37 23 $this->go_to( bp_ core_get_user_domain( $users[1] ) );38 $this->go_to( bp_members_get_user_url( $users[1] ) ); 24 39 25 40 $this->assertFalse( bp_user_has_access( $users[0] ) ); … … 30 45 31 46 $this->set_current_user( $users[0] ); 47 $this->set_permalink_structure( '/%postname%/' ); 32 48 33 $this->go_to( bp_ core_get_user_domain( $users[0] ) );49 $this->go_to( bp_members_get_user_url( $users[0] ) ); 34 50 35 51 $this->assertTrue( bp_user_has_access( $users[0] ) ); -
trunk/tests/phpunit/testcases/members/functions.php
r13431 r13433 5 5 #[AllowDynamicProperties] 6 6 class BP_Tests_Members_Functions extends BP_UnitTestCase { 7 protected $permalink_structure = ''; 8 9 public function set_up() { 10 parent::set_up(); 11 $this->permalink_structure = get_option( 'permalink_structure', '' ); 12 } 13 14 public function tear_down() { 15 $this->set_permalink_structure( $this->permalink_structure ); 16 17 parent::tear_down(); 18 } 7 19 8 20 /** … … 114 126 * @group bp_core_get_directory_pages 115 127 */ 116 public function test_bp_ core_get_user_domain_after_directory_page_update() {128 public function test_bp_members_get_user_url_after_directory_page_update() { 117 129 // Generate user 118 130 $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 131 $this->set_permalink_structure( '/%postname%/' ); 119 132 120 133 // Set object cache first for user domain 121 $user_domain = bp_ core_get_user_domain( $user_id );134 $user_domain = bp_members_get_user_url( $user_id ); 122 135 123 136 // Now change the members directory slug … … 137 150 $user = new WP_User( $user_id ); 138 151 139 $this->assertSame( home_url( $new_members_slug ) . '/' . $user->user_nicename . '/', bp_ core_get_user_domain( $user_id ) );152 $this->assertSame( home_url( $new_members_slug ) . '/' . $user->user_nicename . '/', bp_members_get_user_url( $user_id ) ); 140 153 } 141 154 -
trunk/tests/phpunit/testcases/members/template.php
r12791 r13433 4 4 */ 5 5 class BP_Tests_Members_Template extends BP_UnitTestCase { 6 protected $permalink_structure = ''; 7 8 public function set_up() { 9 parent::set_up(); 10 $this->permalink_structure = get_option( 'permalink_structure', '' ); 11 } 12 13 public function tear_down() { 14 $this->set_permalink_structure( $this->permalink_structure ); 15 16 parent::tear_down(); 17 } 18 6 19 public function test_bp_has_members_include_on_user_page() { 7 20 $u1 = self::factory()->user->create(); 8 21 $u2 = self::factory()->user->create(); 9 10 $this->go_to( bp_core_get_user_domain( $u1 ) ); 22 $this->set_permalink_structure( '/%postname%/' ); 23 24 $this->go_to( bp_members_get_user_url( $u1 ) ); 11 25 12 26 global $members_template; … … 59 73 $old_user = get_current_user_id(); 60 74 $this->set_current_user( $u2 ); 61 62 $this->go_to( bp_core_get_user_domain( $u2 ) . bp_get_friends_slug() . '/requests/' ); 75 $this->set_permalink_structure( '/%postname%/' ); 76 77 $this->go_to( 78 bp_members_get_user_url( 79 $u2, 80 array( 81 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 82 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_friends_requests', 'requests' ), 83 ) 84 ) 85 ); 63 86 $this->restore_admins(); 64 87 … … 86 109 $old_user = get_current_user_id(); 87 110 $this->set_current_user( $u2 ); 111 $this->set_permalink_structure( '/%postname%/' ); 88 112 89 113 // For some reason, in all the user switching, the cache gets … … 93 117 wp_cache_delete( 'bp_user_domain_' . $u2, 'bp' ); 94 118 95 $this->go_to( bp_core_get_user_domain( $u2 ) . bp_get_friends_slug() . '/requests/' ); 119 $this->go_to( 120 bp_members_get_user_url( 121 $u2, 122 array( 123 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 124 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_friends_requests', 'requests' ), 125 ) 126 ) 127 ); 96 128 $this->restore_admins(); 97 129 -
trunk/tests/phpunit/testcases/routing/activity.php
r13431 r13433 6 6 class BP_Tests_Routing_Activity extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_activity_directory() { 25 $this->set_permalink_structure( '/%postname%/' ); 22 26 $this->go_to( bp_get_activity_directory_permalink() ); 23 27 … … 32 36 */ 33 37 function test_activity_permalink() { 38 $this->set_permalink_structure( '/%postname%/' ); 34 39 $a = self::factory()->activity->create(); 35 40 $activity = self::factory()->activity->get_object_by_id( $a ); 36 41 37 $url = bp_core_get_user_domain( $activity->user_id ) . bp_get_activity_slug() . '/' . $activity->id . '/'; 42 $url = bp_members_get_user_url( 43 $activity->user_id, 44 array( 45 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 46 'single_item_action' => $activity->id, 47 ) 48 ); 38 49 $this->go_to( $url ); 39 50 $this->assertTrue( bp_is_single_activity() ); … … 41 52 42 53 function test_member_activity() { 43 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() ); 54 $this->set_permalink_structure( '/%postname%/' ); 55 $this->go_to( 56 bp_members_get_user_url( 57 bp_loggedin_user_id(), 58 array( 59 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 60 ) 61 ) 62 ); 44 63 $this->assertTrue( bp_is_user_activity() ); 45 64 } 46 65 47 66 function test_member_activity_mentions() { 48 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/mentions' ); 67 $this->set_permalink_structure( '/%postname%/' ); 68 $this->go_to( 69 bp_members_get_user_url( 70 bp_loggedin_user_id(), 71 array( 72 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 73 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_mentions', 'mentions' ), 74 ) 75 ) 76 ); 49 77 $this->assertTrue( bp_is_user_activity() ); 50 78 } 51 79 52 80 function test_member_activity_favourites() { 53 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/favorites' ); 81 $this->set_permalink_structure( '/%postname%/' ); 82 $this->go_to( 83 bp_members_get_user_url( 84 bp_loggedin_user_id(), 85 array( 86 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 87 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_favorites', 'favorites' ), 88 ) 89 ) 90 ); 54 91 $this->assertTrue( bp_is_user_activity() ); 55 92 } … … 59 96 */ 60 97 function test_member_activity_friends() { 61 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_friends_slug() ); 98 $this->set_permalink_structure( '/%postname%/' ); 99 $this->go_to( 100 bp_members_get_user_url( 101 bp_loggedin_user_id(), 102 array( 103 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 104 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_friends', bp_get_friends_slug() ), 105 ) 106 ) 107 ); 62 108 $this->assertTrue( bp_is_user_friends_activity() ); 63 109 } … … 67 113 */ 68 114 function test_member_activity_groups() { 69 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_activity_slug() . '/' . bp_get_groups_slug() ); 115 $this->set_permalink_structure( '/%postname%/' ); 116 $this->go_to( 117 bp_members_get_user_url( 118 bp_loggedin_user_id(), 119 array( 120 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_activity', bp_get_activity_slug() ), 121 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_activity_groups', bp_get_groups_slug() ), 122 ) 123 ) 124 ); 70 125 $this->assertTrue( bp_is_user_groups_activity() ); 71 126 } -
trunk/tests/phpunit/testcases/routing/friends.php
r13314 r13433 6 6 class BP_Tests_Routing_Friends extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_member_friends() { 22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() ); 25 $this->set_permalink_structure( '/%postname%/' ); 26 $this->go_to( 27 bp_members_get_user_url( 28 bp_loggedin_user_id(), 29 array( 30 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 31 ) 32 ) 33 ); 23 34 $this->assertTrue( bp_is_user_friends() ); 24 35 } 25 36 26 37 function test_member_friends_requests() { 27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_friends_slug() . '/requests' ); 38 $this->set_permalink_structure( '/%postname%/' ); 39 $this->go_to( 40 bp_members_get_user_url( 41 bp_loggedin_user_id(), 42 array( 43 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_friends', bp_get_friends_slug() ), 44 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_friends_requests', 'requests' ), 45 ) 46 ) 47 ); 28 48 $this->assertTrue( bp_is_user_friend_requests() ); 29 49 } -
trunk/tests/phpunit/testcases/routing/groups.php
r13314 r13433 6 6 class BP_Tests_Routing_Groups extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 12 13 buddypress()->members->types = array(); 13 14 $this->old_current_user = get_current_user_id(); 15 $this->permalink_structure = get_option( 'permalink_structure', '' ); 14 16 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 15 17 } … … 18 20 parent::tear_down(); 19 21 $this->set_current_user( $this->old_current_user ); 22 $this->set_permalink_structure( $this->permalink_structure ); 20 23 } 21 24 22 25 function test_member_groups() { 23 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() ); 26 $this->set_permalink_structure( '/%postname%/' ); 27 $this->go_to( 28 bp_members_get_user_url( 29 bp_loggedin_user_id(), 30 array( 31 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ), 32 ) 33 ) 34 ); 24 35 $this->assertTrue( bp_is_user_groups() ); 25 36 } 26 37 27 38 function test_member_groups_invitations() { 28 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_groups_slug() . '/invites' ); 39 $this->set_permalink_structure( '/%postname%/' ); 40 $this->go_to( 41 bp_members_get_user_url( 42 bp_loggedin_user_id(), 43 array( 44 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_groups', bp_get_groups_slug() ), 45 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_friends_invites', 'invites' ), 46 ) 47 ) 48 ); 29 49 $this->assertTrue( bp_is_user_groups() && bp_is_current_action( 'invites' ) ); 30 50 } … … 34 54 */ 35 55 public function test_group_directory_with_type() { 56 $this->set_permalink_structure( '/%postname%/' ); 36 57 bp_groups_register_group_type( 'foo' ); 37 58 $this->go_to( bp_get_groups_directory_permalink() . 'type/foo/' ); … … 43 64 */ 44 65 public function test_group_directory_with_type_that_has_custom_directory_slug() { 66 $this->set_permalink_structure( '/%postname%/' ); 45 67 bp_groups_register_group_type( 'foo', array( 'has_directory' => 'foos' ) ); 46 68 $this->go_to( bp_get_groups_directory_permalink() . 'type/foos/' ); … … 52 74 */ 53 75 public function test_group_directory_should_404_for_group_types_that_have_no_directory() { 76 $this->set_permalink_structure( '/%postname%/' ); 54 77 bp_register_member_type( 'foo', array( 'has_directory' => false ) ); 55 78 $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' ); … … 61 84 */ 62 85 public function test_group_directory_should_404_for_invalid_group_types() { 86 $this->set_permalink_structure( '/%postname%/' ); 63 87 $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' ); 64 88 $this->assertTrue( is_404() ); … … 69 93 */ 70 94 public function test_group_previous_slug_current_slug_should_resolve() { 95 $this->set_permalink_structure( '/%postname%/' ); 71 96 $g1 = self::factory()->group->create( array( 72 97 'slug' => 'george', … … 86 111 */ 87 112 public function test_group_previous_slug_should_resolve() { 113 $this->set_permalink_structure( '/%postname%/' ); 88 114 $g1 = self::factory()->group->create( array( 89 115 'slug' => 'george', … … 104 130 */ 105 131 public function test_group_previous_slug_most_recent_takes_precedence() { 132 $this->set_permalink_structure( '/%postname%/' ); 106 133 $g1 = self::factory()->group->create( array( 107 134 'slug' => 'george', -
trunk/tests/phpunit/testcases/routing/members.php
r13431 r13433 6 6 class BP_Tests_Routing_Members extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 12 13 buddypress()->members->types = array(); 13 14 $this->old_current_user = get_current_user_id(); 15 $this->permalink_structure = get_option( 'permalink_structure', '' ); 14 16 $this->set_current_user( self::factory()->user->create( array( 'user_login' => 'paulgibbs', 'role' => 'subscriber' ) ) ); 15 17 } … … 17 19 public function tear_down() { 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 parent::tear_down(); 20 23 } 21 24 22 25 function test_members_directory() { 26 $this->set_permalink_structure( '/%postname%/' ); 23 27 $this->go_to( bp_get_members_directory_permalink() ); 24 28 … … 30 34 31 35 function test_member_permalink() { 32 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) ); 36 $this->set_permalink_structure( '/%postname%/' ); 37 $this->go_to( bp_members_get_user_url( bp_loggedin_user_id() ) ); 33 38 $this->assertTrue( bp_is_my_profile() ); 34 39 } … … 39 44 */ 40 45 public function test_member_directory_with_member_type() { 46 $this->set_permalink_structure( '/%postname%/' ); 41 47 bp_register_member_type( 'foo' ); 42 48 $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' ); … … 49 55 */ 50 56 public function test_member_directory_with_member_type_should_obey_filtered_type_slug() { 57 $this->set_permalink_structure( '/%postname%/' ); 51 58 bp_register_member_type( 'foo' ); 52 59 … … 66 73 */ 67 74 public function test_member_directory_with_member_type_that_has_custom_directory_slug() { 75 $this->set_permalink_structure( '/%postname%/' ); 68 76 bp_register_member_type( 'foo', array( 'has_directory' => 'foos' ) ); 69 77 $this->go_to( bp_get_members_directory_permalink() . 'type/foos/' ); … … 76 84 */ 77 85 public function test_member_directory_with_member_type_should_be_overridden_by_member_with_same_nicename() { 86 $this->set_permalink_structure( '/%postname%/' ); 78 87 $u = self::factory()->user->create( array( 'user_nicename' => 'foo' ) ); 79 88 bp_register_member_type( 'foo' ); … … 91 100 */ 92 101 public function test_member_directory_should_404_for_member_types_that_have_no_directory() { 102 $this->set_permalink_structure( '/%postname%/' ); 93 103 bp_register_member_type( 'foo', array( 'has_directory' => false ) ); 94 104 $this->go_to( bp_get_members_directory_permalink() . 'type/foo/' ); … … 100 110 */ 101 111 function test_members_shortlink_redirector() { 112 $this->set_permalink_structure( '/%postname%/' ); 102 113 $shortlink_member_slug = 'me'; 103 114 -
trunk/tests/phpunit/testcases/routing/messages.php
r13314 r13433 6 6 class BP_Tests_Routing_Messages extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_member_messages() { 22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() ); 25 $this->set_permalink_structure( '/%postname%/' ); 26 $this->go_to( 27 bp_members_get_user_url( 28 bp_loggedin_user_id(), 29 array( 30 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ), 31 ) 32 ) 33 ); 23 34 $this->assertTrue( bp_is_messages_inbox() ); 24 35 } 25 36 26 37 function test_member_messages_sentbox() { 27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/sentbox' ); 38 $this->set_permalink_structure( '/%postname%/' ); 39 $this->go_to( 40 bp_members_get_user_url( 41 bp_loggedin_user_id(), 42 array( 43 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ), 44 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_messages_sentbox', 'sentbox' ), 45 ) 46 ) 47 ); 28 48 $this->assertTrue( bp_is_messages_sentbox() ); 29 49 } 30 50 31 51 function test_member_messages_compose() { 32 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/compose' ); 52 $this->set_permalink_structure( '/%postname%/' ); 53 $this->go_to( 54 bp_members_get_user_url( 55 bp_loggedin_user_id(), 56 array( 57 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ), 58 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_messages_compose', 'compose' ), 59 ) 60 ) 61 ); 33 62 $this->assertTrue( bp_is_messages_compose_screen() ); 34 63 } 35 64 36 65 function test_member_messages_notices() { 37 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_messages_slug() . '/notices' ); 66 $this->set_permalink_structure( '/%postname%/' ); 67 $this->go_to( 68 bp_members_get_user_url( 69 bp_loggedin_user_id(), 70 array( 71 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_messages', bp_get_messages_slug() ), 72 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_messages_notices', 'notices' ), 73 ) 74 ) 75 ); 38 76 $this->assertTrue( bp_is_notices() ); 39 77 } -
trunk/tests/phpunit/testcases/routing/settings.php
r13314 r13433 6 6 class BP_Tests_Routing_Settings extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_member_settings() { 22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() ); 25 $this->set_permalink_structure( '/%postname%/' ); 26 $this->go_to( 27 bp_members_get_user_url( 28 bp_loggedin_user_id(), 29 array( 30 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ), 31 ) 32 ) 33 ); 23 34 $this->assertTrue( bp_is_user_settings_general() ); 24 35 } 25 36 26 37 function test_member_settings_notifications() { 27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/notifications' ); 38 $this->set_permalink_structure( '/%postname%/' ); 39 $this->go_to( 40 bp_members_get_user_url( 41 bp_loggedin_user_id(), 42 array( 43 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ), 44 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_settings_notifications', 'notifications' ), 45 ) 46 ) 47 ); 28 48 $this->assertTrue( bp_is_user_settings_notifications() ); 29 49 } … … 31 51 // @todo How best to test this? 32 52 /*function bp_is_user_settings_account_capbilities() { 33 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/capabilities' ); 53 $this->set_permalink_structure( '/%postname%/' ); 54 $this->go_to( 55 bp_members_get_user_url( 56 bp_loggedin_user_id(), 57 array( 58 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ), 59 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_settings_capabilities', 'capabilities' ), 60 ) 61 ) 62 ); 34 63 }*/ 35 64 36 65 function bp_is_user_settings_account_delete() { 37 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_settings_slug() . '/delete-account' ); 66 $this->set_permalink_structure( '/%postname%/' ); 67 $this->go_to( 68 bp_members_get_user_url( 69 bp_loggedin_user_id(), 70 array( 71 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_settings', bp_get_settings_slug() ), 72 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_settings_delete_account', 'delete-account' ), 73 ) 74 ) 75 ); 38 76 $this->assertTrue( bp_is_user_settings_account_delete() ); 39 77 } -
trunk/tests/phpunit/testcases/routing/xprofile.php
r13314 r13433 6 6 class BP_Tests_Routing_XProfile extends BP_UnitTestCase { 7 7 protected $old_current_user = 0; 8 protected $permalink_structure = ''; 8 9 9 10 public function set_up() { … … 11 12 12 13 $this->old_current_user = get_current_user_id(); 14 $this->permalink_structure = get_option( 'permalink_structure', '' ); 13 15 $this->set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 14 16 } … … 17 19 parent::tear_down(); 18 20 $this->set_current_user( $this->old_current_user ); 21 $this->set_permalink_structure( $this->permalink_structure ); 19 22 } 20 23 21 24 function test_member_profile() { 22 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() ); 25 $this->set_permalink_structure( '/%postname%/' ); 26 $this->go_to( 27 bp_members_get_user_url( 28 bp_loggedin_user_id(), 29 array( 30 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 31 ) 32 ) 33 ); 23 34 $this->assertTrue( bp_is_user_profile() ); 24 35 } 25 36 26 37 function test_member_profile_edit() { 27 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() . '/edit' ); 38 $this->set_permalink_structure( '/%postname%/' ); 39 $this->go_to( 40 bp_members_get_user_url( 41 bp_loggedin_user_id(), 42 array( 43 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 44 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_profile_edit', 'edit' ), 45 ) 46 ) 47 ); 28 48 $this->assertTrue( bp_is_user_profile_edit() ); 29 49 } 30 50 31 51 function test_member_profile_change_avatar() { 32 $this->go_to( bp_core_get_user_domain( bp_loggedin_user_id() ) . bp_get_profile_slug() . '/change-avatar' ); 52 $this->set_permalink_structure( '/%postname%/' ); 53 $this->go_to( 54 bp_members_get_user_url( 55 bp_loggedin_user_id(), 56 array( 57 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 58 'single_item_action' => bp_rewrites_get_slug( 'members', 'member_profile_change_avatar', 'change-avatar' ), 59 ) 60 ) 61 ); 33 62 $this->assertTrue( bp_is_user_change_avatar() ); 34 63 } -
trunk/tests/phpunit/testcases/xprofile/activity.php
r13314 r13433 307 307 ) ); 308 308 309 $expected = sprintf( esc_html__( "%s's profile was updated", 'buddypress' ), '<a href="' . bp_core_get_user_domain( $u ) . bp_get_profile_slug() . '/">' . bp_core_get_user_displayname( $u ) . '</a>' ); 309 $link = bp_members_get_user_url( 310 $u, 311 array( 312 'single_item_component' => bp_rewrites_get_slug( 'members', 'member_profile', bp_get_profile_slug() ), 313 ) 314 ); 315 $expected = sprintf( esc_html__( "%s's profile was updated", 'buddypress' ), '<a href="' . esc_url( $link ) . '">' . bp_core_get_user_displayname( $u ) . '</a>' ); 310 316 311 317 $a_obj = new BP_Activity_Activity( $a );
Note: See TracChangeset
for help on using the changeset viewer.