Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dwanjuki/db1356ff2792e602254ec34e0b4b9e45 to your computer and use it in GitHub Desktop.
Save dwanjuki/db1356ff2792e602254ec34e0b4b9e45 to your computer and use it in GitHub Desktop.
Example of using the pmpro_confirmation_url filter to change the PMPro confirmation page for new users.
<?php
/**
* Change the membership confirmation page for new members only
*
* 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_confirmation_url($url, $user_id, $level) {
$already_member = get_user_meta( $user_id, 'already_member', true );
if( ! $already_member ) {
update_user_meta( $user_id, 'already_member', 1 );
$url = home_url('/my-dashboard');
}
return $url;
}
add_filter( 'pmpro_confirmation_url', 'my_pmpro_confirmation_url', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment