/** * Creates a new room code and saves to db */ function aiwp_expire_room() { $aiwp_room = aiwp_random_room(); update_option('aiwp_public_room', $aiwp_room); }
/** * Schedules the cron for expiring and resetting a daily public room name. * * @since 1.0 */ public function schedule_cron() { // on plugin activation, get random room code $random_room = aiwp_random_room(); // assign to public room add_option('aiwp_public_room', $random_room); // schedule default public room name to reset each day at midnight wp_schedule_event(strtotime('today midnight'), 'daily', 'expireroom'); }