Created
October 31, 2025 11:50
-
-
Save JarrydLong/3e7e8503fe63dcbfe4cba6b392aa0842 to your computer and use it in GitHub Desktop.
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 //do not copy | |
| /** | |
| * This recipe forces every checkout to require approval. | |
| * | |
| * Requires the Approvals Add On to be active for this to work. | |
| * | |
| * 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_require_approval_for_every_signup( $user_id, $morder ) { | |
| $level_id = $morder->membership_level->id; | |
| $current_user = wp_get_current_user(); | |
| //Force pending approval for every checkout | |
| update_user_meta( | |
| $user_id, 'pmpro_approval_' . $level_id, array( | |
| 'status' => 'pending', | |
| 'timestamp' => current_time( 'timestamp' ), | |
| 'who' => $current_user->ID, | |
| 'approver' => $current_user->user_login, | |
| ) | |
| ); | |
| } | |
| add_action('pmpro_after_checkout', 'my_pmpro_require_approval_for_every_signup', 99, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment