Get MailChimp lists from cache.
public get_cached_lists ( boolean $force = false ) : array | ||
$force | boolean | Force a result, by hitting remote API. |
return | array |
/** * Show the API Settings page */ public function show_generals_setting_page() { $opts = mc4wp_get_options(); $connected = !empty($opts['api_key']); if ($connected) { try { $connected = $this->get_api()->is_connected(); } catch (MC4WP_API_Connection_Exception $e) { $message = sprintf("<strong>%s</strong><br /> %s", __("Error connecting to MailChimp:", 'mailchimp-for-wp'), $e); $message .= '<br /><br />' . sprintf('<a href="%s">' . __('Here\'s some info on solving common connectivity issues.', 'mailchimp-for-wp') . '</a>', 'https://mc4wp.com/kb/solving-connectivity-issues/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=settings-notice'); $this->messages->flash($message, 'error'); $connected = false; } catch (MC4WP_API_Exception $e) { $this->messages->flash(sprintf("<strong>%s</strong><br /> %s", __("MailChimp returned the following error:", 'mailchimp-for-wp'), $e), 'error'); $connected = false; } } $lists = $this->mailchimp->get_cached_lists(); $obfuscated_api_key = mc4wp_obfuscate_string($opts['api_key']); require MC4WP_PLUGIN_DIR . 'includes/views/general-settings.php'; }
/** * @return int */ protected function get_mailchimp_lists_count() { $mailchimp = new MC4WP_MailChimp(); $lists = $mailchimp->get_cached_lists(); return count($lists); }