small tweak to not break for users with names that include spaces. the issue was not a permissions one as i posted above.
/*
* attempt to handle generic request for current user
* https://bbpress.org/forums/topic/how-do-i-link-to-profile-page/
*
* if the url is passed as forums/users/current/
* this function detects that the permalink has been set to bbp_user=current
* and
* - if the user is logged on, the query is changed to the current user
* - if the user is not logged on, the user is redirected to login screen
*
*/
function ink_bbp_request_current_user( $query_vars ) {
if ( isset( $query_vars[ 'bbp_user' ] ) ) {
switch ( $query_vars[ 'bbp_user' ] ) {
case 'current':
if ( get_current_user_id() ) {
$query_vars[ 'bbp_user' ] = bbp_get_user_nicename(get_current_user_id());
} else {
auth_redirect();
}
}
}
return $query_vars;
}
add_filter( 'bbp_request', 'ink_bbp_request_current_user', 10, 1 );
@jonathanmoorebcs for me, your code works great for admin users, but fails for contributor role users