Forked from strangerstudios/my_pmpro_checkout_start_date.php
Created
March 14, 2022 09:07
-
-
Save JarrydLong/d6b89d5ea48e54d9d77637d19add2c9a to your computer and use it in GitHub Desktop.
PMPro Adjust start date to the first following Sunday.
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 | |
| /* | |
| Adjust start date to the first following Sunday for a specific level | |
| */ | |
| function my_pmpro_checkout_start_date( $startdate, $user_id, $level ){ | |
| if( $level->id == 8 ) { //Change to the preferred level you want this to apply to | |
| //which day is it | |
| $checkout_day = date("N"); | |
| //days to sunday | |
| $days_to_sunday = 7 - $checkout_day; | |
| //add the days | |
| $startdate = date("Y-m-d", strtotime("+ " . $days_to_sunday . " days")); | |
| } | |
| return $startdate; | |
| } | |
| add_filter( 'pmpro_checkout_start_date', 'my_pmpro_checkout_start_date', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment