Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/847177adcca2523c630990ded1a69d81 to your computer and use it in GitHub Desktop.
Save kimwhite/847177adcca2523c630990ded1a69d81 to your computer and use it in GitHub Desktop.
Redirect the Membership Account page to the user's BuddyPress Profile.
<?php
/**
* This recipe Redirect the Profile Edit page to the user's BuddyPress Profile.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_buddypress_profile_template_redirect() {
global $pmpro_pages;
// Make sure PMPro is active.
if ( empty( $pmpro_pages ) ) {
return;
}
// Make sure BuddyPress is active.
if ( ! function_exists( 'bp_loggedin_user_domain' ) ) {
return;
}
// Redirect the Membership Account page to the bbPress User Profile.
if ( is_page( $pmpro_pages['member_profile_edit'] ) ) {
wp_redirect( bp_loggedin_user_domain() );
exit;
}
}
add_action( 'template_redirect', 'my_pmpro_buddypress_profile_template_redirect' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment