Last active
April 12, 2023 23:22
-
-
Save andrewlimaza/563be9bf3a0b369fa3747ec78cad1513 to your computer and use it in GitHub Desktop.
Revisions
-
andrewlimaza revised this gist
Nov 14, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ function my_pmpro_default_registration_level($user_id) { $custom_level = array( 'user_id' => $user_id, 'membership_id' => 2, 'code_id' => '', 'initial_payment' => $level->initial_payment, 'billing_amount' => $level->billing_amount, -
andrewlimaza created this gist
Nov 14, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php // Adjusted from https://www.paidmembershipspro.com/give-users-a-default-membership-level-at-registration/ //Disables the pmpro redirect to levels page when user tries to register add_filter("pmpro_login_redirect", "__return_false"); function my_pmpro_default_registration_level($user_id) { $level = pmpro_getLevel( 2 ); $custom_level = array( 'user_id' => $user_id, 'membership_id' => $level_id, 'code_id' => '', 'initial_payment' => $level->initial_payment, 'billing_amount' => $level->billing_amount, 'cycle_number' => $level->cycle_number, 'cycle_period' => $level->cycle_period, 'billing_limit' => $level->billing_limit, 'trial_amount' => $level->trial_amount, 'trial_limit' => $level->trial_limit, 'startdate' => "'" . current_time('mysql') . "'", 'enddate' => date("Y-m-d", strtotime("+" . $level->expiration_number . " " . $level->expiration_period)), ); pmpro_changeMembershipLevel($custom_level, $user_id); } add_action('user_register', 'my_pmpro_default_registration_level');