Forked from cartpauj/auto-approve-memberpress-new-user-approve.php
Created
April 13, 2020 08:33
-
-
Save JudeRosario/91b2cf871958840b6c4538521546bd7d to your computer and use it in GitHub Desktop.
Auto Approve Sub Accounts - and a list of Memberships by ID
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 | |
// allow for verification to be required for free trial users. | |
function mepr_newuser_approve_override($user_id) { | |
$auto_approve = array(970688, 970684, 970687, 970686, 970685); //An array of product ID's to auto approve | |
if(!class_exists('MeprOptions')) { return; } | |
if(!isset($_POST['mepr_product_id']) && !isset($_POST['manage_sub_accounts_form'])) { return $user_id; } //Not a MemberPress signup? | |
$product_id = isset($_POST['mepr_product_id'])?$_POST['mepr_product_id']:false; | |
if(isset($_POST['manage_sub_accounts_form']) || ($product_id && in_array($product_id, $auto_approve))) { | |
$_REQUEST['action'] = 'createuser'; | |
} | |
} | |
add_filter('user_register', 'mepr_newuser_approve_override', 8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment