/** * Display a footer below the Settings box. * The footer will show information on the next scheduled cron jobs and also * allow the user to run these jobs instantly. * * @since 1.0.0 * @param string $tab_name Name of the currently open settings-tab. */ protected function render_settings_footer($tab_name) { if ('general' != $tab_name) { return; } $status_stamp = wp_next_scheduled('ms_cron_check_membership_status') - time(); $email_stamp = wp_next_scheduled('ms_cron_process_communications') - time(); if ($status_stamp > 0) { $status_delay = sprintf(__('in %s hrs %s min', 'membership2'), floor(($status_stamp - 1) / 3600), date('i', $status_stamp)); } else { $status_delay = __('(now...)', 'membership2'); } if ($email_stamp > 0) { $email_delay = sprintf(__('in %s hrs %s min', 'membership2'), floor(($email_stamp - 1) / 3600), date('i', $email_stamp)); } else { $email_delay = __('(now...)', 'membership2'); } $status_url = esc_url_raw(add_query_arg(array('run_cron' => 'ms_cron_check_membership_status'))); $email_url = esc_url_raw(add_query_arg(array('run_cron' => 'ms_cron_process_communications'))); $lbl_run = __('Run now!', 'membership2'); echo '<div class="cf ms-settings-footer"><div class="ms-tab-container"> </div>'; echo '<div>'; if (MS_Plugin::get_modifier('MS_LOCK_SUBSCRIPTIONS')) { _e('Membership Status Checks are disabled.', 'membership2'); echo ' '; } else { printf(__('Check Membership Status changes %s.') . ' ', '<a href="' . $status_url . '" title="' . $lbl_run . '">' . $status_delay . '</a>'); } if (MS_Plugin::get_modifier('MS_STOP_EMAILS')) { _e('Sending Email Responses is disabled.', 'membership2'); } else { $count = MS_Model_Communication::get_queue_count(); if (!$count) { $msg = __('No pending Email Responses found', 'membership2'); } elseif (1 == $count) { $msg = __('Send 1 pending Email Response %1$s', 'membership2'); } else { $msg = __('Send %2$s pending Email Responses %1$s', 'membership2'); } printf($msg, '<a href="' . $email_url . '"title="' . $lbl_run . '">' . $email_delay . '</a>', $count); } echo '</div></div>'; }