Last active
April 13, 2021 04:22
-
-
Save strangerstudios/8e2483e57062462c84c5fb5e51398ea9 to your computer and use it in GitHub Desktop.
Redirect the Membership Account page to the bbPress User Profile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Redirect the Membership Account page to the bbPress User Profile. | |
*/ | |
function my_pmpro_bbpress_profile_template_redirect() | |
{ | |
global $pmpro_pages, $current_user; | |
//make sure PMPro is active | |
if(empty($pmpro_pages)) | |
return; | |
//make sure bbPress is active | |
if(!function_exists('bbp_get_user_profile_url')) | |
return; | |
//Redirect the Membership Account page to the bbPress User Profile. | |
if( is_page($pmpro_pages['account']) ) | |
{ | |
wp_redirect( bbp_get_user_profile_url( bbp_get_current_user_id() ) ); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'my_pmpro_bbpress_profile_template_redirect'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Set the bbPress User Profile as Membership Account Page" at Paid Memberships Pro here: https://www.paidmembershipspro.com/set-bbpress-user-profile-membership-account-page/