| 126 | * Tell Tagregator to stop importing items for a camp 2 weeks after it has occurred. |
| 127 | * |
| 128 | * @param DateTime|null $end_date The date that Tagregator should stop importing items for a camp. Default null. |
| 129 | */ |
| 130 | function wcorg_set_per_camp_tagregator_end_date( $end_date ) { |
| 131 | $details = get_wordcamp_post(); |
| 132 | |
| 133 | if ( isset( $details->meta['Start Date (YYYY-mm-dd)'][0] ) ) { |
| 134 | $offset = '2 weeks'; |
| 135 | |
| 136 | // Despite its key/label, the start date value is actually stored as a Unix timestamp. |
| 137 | $camp_start_timestamp = $details->meta['Start Date (YYYY-mm-dd)'][0]; |
| 138 | $end_date = date_create( date( 'Y-m-d', $camp_start_timestamp ) . ' + ' . $offset ); |
| 139 | } |
| 140 | |
| 141 | return $end_date; |
| 142 | } |
| 143 | add_filter( 'tggr_end_date', 'wcorg_set_per_camp_tagregator_end_date' ); |
| 144 | |
| 145 | /** |