How to redirect away from bbpress profile
-
Hi there,
I’m working with a custom profile setup (consolidating the profiles from multiple plugins) and and wondering how I can redirect a bbpress user to this central profile when they try to access their forum profile. In other words, how do I make it so that someone who tries to visit:
http://www.example.com/forums/user/johnsmith
is redirected to:
http://www.example.com/profile
I saw a very old post in this forum that discussed this topic, and they suggested using the following method:
add_action('bb_init', 'profile_redirect'); function profile_redirect() { if (is_bb_profile() && $_GET['tab'] != 'edit' && $_GET['tab'] != 'favorites') { $user = bb_get_user($_GET['id']); if ($user) wp_redirect("http://www.example.com/member/" . $user->user_nicename); } }
Since it’s so old, it doesn’t work anymore, and honestly, what I’d like to do is slightly different. I’d like to redirect a user away from the profile page (regardless of which section they’re on–whether it be favorites, subscriptions, or edit profile) as long as:
- They are logged in
- They are on their ownprofile page
How could I do that with the current version of WordPress?
- You must be logged in to reply to this topic.