Lists(); $authentication = false; if( $check != 'Unable to authenticate' ) { $authentication = true; } set_transient( 'mal_authenticate_credentials', $authentication, HOUR_IN_SECONDS ); } return $authentication; } add_action('admin_menu', 'mal_settings_page', 99); /** * Add Setting Page * * Adds the settings page which contains the fields for the username * and API key. Also initializes the settings that hold these * values. * * @author Daniel Pataki * @since 1.0.0 * */ function mal_settings_page() { $post_type = ( post_type_exists('acf-field-group') ) ? 'acf-field-group' : 'acf'; add_submenu_page( 'edit.php?post_type=' . $post_type, _x( 'MadMimi Settings', 'In the title tag of the page', 'acf-madmimi_audience_list' ), _x( 'MadMimi Settings', 'Menu title', 'acf-madmimi_audience_list' ), 'manage_options', 'acf-madmimi_audience_list-settings', 'mal_settings_page_content'); add_action( 'admin_init', 'mal_register_settings' ); } /** * Register Settings * * Registers plugin-wide settings, we use this for the username * and the API key * * @author Daniel Pataki * @since 1.0.0 * */ function mal_register_settings() { register_setting( 'mal_settings', 'mal_madmimi_access' ); } /** * Settings Page Content * * The UI for the settings page. It contains the form, as well as * a quick check to make sure the given credentials work. * * @author Daniel Pataki * @since 1.0.0 * */ function mal_settings_page_content() { delete_transient( 'mal_audience_lists' ); delete_transient( 'mal_authenticate_credentials' ); if( !empty( $_POST ) ) { update_option( 'mal_madmimi_access', $_POST['mal_madmimi_access'] ); } ?>