/** * Addon settings. * * Add new settings to the plugin settings page. * * @since 1.0.0 * * @param array $settings Pre-existing settings * * @return array Updated settings containing MailChimp options */ function wpbo_mp_settings($settings) { $lists = wpbo_mp_get_mailpoet_lists(); $lists_list[''] = esc_html_x('Please select...', 'Select a MailPoet mailing list', 'betteroptin'); foreach ($lists as $list) { $lists_list[$list['list_id']] = $list['name']; } $list_id = array('name' => __('List', 'betteroptin'), 'id' => 'mp_list_id', 'type' => 'select', 'options' => $lists_list, 'default' => ''); $settings['mailpoet'] = array('name' => __('MailPoet', 'betteroptin'), 'options' => array($list_id)); return $settings; }
<?php global $wpbo_submit; $lists = wpbo_mp_get_mailpoet_lists(); $default = wpbo_get_option('mp_list_id'); $opts = array(); $value = isset($_GET['post']) ? get_post_meta(intval($_GET['post']), 'wpbo_mp_list', true) : ''; foreach ($lists as $key => $list) { $opts[$list['list_id']] = $list['name']; } $def_name = $opts[$default]; if ('' == $value) { ?> <p><?php printf(__('If you don\'t select a list here, the default one will be used (currently %s).', 'betteroptin'), "<code>{$def_name}</code>"); ?> </p> <?php } ?> <select id="wpbo_mp_list" name="wpbo_mp_list" style="width:100%"> <option value="" <?php if ('' == $value) { ?> selected="selected"<?php } ?> ><?php _e('Default', 'betteroptin');