change http://www.examplesite.com/members/username/projects to http://www.example.com/projects/username
function bp_projects_rewrite_bp_uri($path) {
if(strpos($path, 'projects/') === 1 && strlen( $path) > 5 ) {
//Find the position of the second '/' and add one to fix the start of the username.
$members_start_pos = strpos( $path, '/', 2 ) +1;
//Find the end point of the username
$members_end_pos = strpos( $path, '/', $members_start_pos );
//Strip the username out of the input URL
$username = substr( $path, $members_start_pos, $members_end_pos - $members_start_pos );
//Return the reconstructed URL, which BP will accet as a valid page.
return 'members/'.$username.'/card/';
}
return $path;
}
add_filter('bp_uri', 'bp_projects_rewrite_bp_uri');