Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JudeRosario/91b2cf871958840b6c4538521546bd7d to your computer and use it in GitHub Desktop.
Save JudeRosario/91b2cf871958840b6c4538521546bd7d to your computer and use it in GitHub Desktop.
Auto Approve Sub Accounts - and a list of Memberships by ID
<?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