Forked from strangerstudios/my_pmpro_default_registration_level.php
Last active
August 16, 2021 16:24
-
-
Save MaryOJob/c4bc71232dd4f700e0b43d16e4e9fe9b to your computer and use it in GitHub Desktop.
my_pmpro_default_registration_level
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
<?php // do not copy this line | |
/** | |
* When registering, add the member to a specific membership level | |
* @param integer $user_id | |
* Add this to a PMPro customizations or Code Snippets Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
**/ | |
//Disables the pmpro redirect to levels page when user tries to register | |
add_filter("pmpro_login_redirect", "__return_false"); | |
//Give all members who register membership level 4 | |
function my_pmpro_default_registration_level($user_id) { | |
pmpro_changeMembershipLevel(4, $user_id); // replace 4 with the ID of your membership level | |
} | |
add_action('user_register', 'my_pmpro_default_registration_level'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment