Using BuddyPress, I am attempting to redirect all registered users to their user profile; however when redirecting the resulting URL is not including the user_login... as a result every user is redirecting to "domain/members/".
How can I get the username to show up in the URL to then redirect to the following: "domain/members/username/"?
FUNCTIONS.PHP
add_filter('login_redirect', function ($redirect_to, $request, $user){
if (user_can($user, 'registered')){
$current_user = wp_get_current_user();
return '/members/' . $current_user->user_login . '/';
}
}