Forked from strangerstudios/my_pmpro_confirmation_url.php
Last active
January 15, 2025 13:22
-
-
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.
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
<?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