Forked from strangerstudios/my_pmpro_bbpress_profile_template_redirect.php
Created
October 8, 2018 03:56
-
-
Save itsjusteileen/dbb6ced36ebcd60c4f31f7bc00664c57 to your computer and use it in GitHub Desktop.
Redirect the Membership Account page to the bbPress User Profile.
This file contains hidden or 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