Making WordPress.org


Ignore:
Timestamp:
09/20/2018 08:43:38 AM (6 years ago)
Author:
vedjain
Message:

WordCamp: Add 'weekly' interval to cron

This is to be used in meetup badges cron.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-loader.php

    r7607 r7685  
    2020        add_action( 'init', array( $this, 'register_post_statuses' ) );
    2121        add_filter( 'pre_get_posts', array( $this, 'query_public_statuses_on_archives' ) );
     22        add_filter( 'cron_schedules', array( $this, 'add_weekly_cron_interval' ) );
    2223    }
    2324
     
    109110    }
    110111
     112    /**
     113     * Add weekly schedule option to wp_schedule_event
     114     *
     115     * @param array $new_schedules
     116     * @param array $schedules
     117     *
     118     * @return array
     119     */
     120    public function add_weekly_cron_interval( $schedules ) {
     121        if ( isset( $schedules['weekly'] ) ) {
     122            return $schedules;
     123        }
     124
     125        $schedules['weekly'] = array(
     126            'interval' => WEEK_IN_SECONDS,
     127            'display'  => __( 'Once weekly', 'wordcamporg' )
     128        );
     129
     130        return $schedules;
     131    }
     132
    111133}
Note: See TracChangeset for help on using the changeset viewer.