Re: All links are working, minus my admin/author/all of my pages
Ok, I *believe* this is what i changed (i’m on latest trunk) to default urls to the nicename – I’ll double check tomorrow though.
in bp-core.php – i modified the two functions here:
function bp_core_get_userid( $username ) {
global $wpdb;
if ( !empty( $username ) ) {
//MYCHANGE - default to user_nicename
if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
else
return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_nicename = %s", $username ) ) );
}
}
function bp_core_get_username( $user_id, $user_nicename = false, $user_login = false ) {
global $bp;
if ( !$username = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ) ) {
if ( empty( $user_nicename ) && empty( $user_login ) ) {
$ud = false;
if ( $bp->loggedin_user->id == $user_id )
$ud = &$bp->loggedin_user->userdata;
if ( $bp->displayed_user->id == $user_id )
$ud = &$bp->displayed_user->userdata;
if ( empty( $ud ) ) {
if ( !$ud = bp_core_get_core_userdata( $user_id ) )
return false;
}
$user_nicename = $ud->user_nicename;
$user_login = $ud->user_login;
}
//MYCHANGE - default to user_nicename
if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
$username = $user_login;
else
$username = $user_nicename;
}
/* Add this to cache */
if ( !empty( $username ) )
wp_cache_set( 'bp_user_username_' . $user_id, $username, 'bp' );
return apply_filters( 'bp_core_get_username', $username );
}
then in bp-core-catchuri.php under function bp_core_set_uri_globals()
/* Catch a member page and set the current member ID */
if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) {
if ( ( $bp_uri[0] == BP_MEMBERS_SLUG && !empty( $bp_uri[1] ) ) || in_array( 'wp-load.php', $bp_uri ) ) {
// We are within a member page, set up user id globals
$displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
unset($bp_uri[0]);
unset($bp_uri[1]);
/* Reset the keys by merging with an empty array */
$bp_uri = array_merge( array(), $bp_uri );
}
} else {
//MYCHANGE - default to user_nicename
if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) {
$_udl = get_userdatabylogin( $bp_uri[0] );
} else {
$_udl = get_user_by('slug', $bp_uri[0] );
}
if ( $_udl || in_array( 'wp-load.php', $bp_uri ) ) {
$is_member_page = true;
$is_root_component = true;
// We are within a member page, set up user id globals
$displayed_user_id = bp_core_get_displayed_userid( $bp_uri[0] );
unset($bp_uri[0]);
/* Reset the keys by merging with an empty array */
$bp_uri = array_merge( array(), $bp_uri );
}
}