*/ add_action( 'admin_init', 'ath_calameo_credentials_init' ); function ath_calameo_credentials_init() { register_setting( 'calameo_credentials', 'calameo_credentials', 'ath_calameo_validate_credentials' ); /*API credentials section*/ add_settings_section( 'calameo_credentials_section', 'Enter your API credentials', 'calameo_section_callback', __FILE__ ); add_settings_field( 'calameo_api_key', 'Calameo API key', 'ath_calameo_api_key_callback', __FILE__, 'calameo_credentials_section' ); add_settings_field( 'calameo_api_secret', 'Calameo API secret', 'ath_calameo_api_secret_callback', __FILE__, 'calameo_credentials_section' ); } add_action( 'admin_menu', 'ath_calameo_credentials_page' ); /* Add sub option page to the Settings Menu */ function ath_calameo_credentials_page() { global $ath_calameo_credentials_page_hook; $ath_calameo_credentials_page_hook = add_options_page( 'Calameo Credentials', 'Calameo Credentials', 'manage_options', 'calameo_credentials', 'ath_calameo_credentials_form' ); /* Calling function which will add new tabs to contextual menu when loads */ add_action( 'load-'. $ath_calameo_credentials_page_hook, 'ath_calameo_credentials_help_tabs' ); add_action( 'load-'. $ath_calameo_credentials_page_hook, 'ath_calameo_add_setting_error_wp_calameo_not_installed' ); } /* Callbacks function */ global $calameo_credentials; $calameo_credentials = get_option( 'calameo_credentials' ); function ath_calameo_api_key_callback() { global $calameo_credentials; add_settings_error( $calameo_credentials['calameo_api_secret'], 'txt_multinumeric_error', __('Please enter a valid Calameo API Secret'), 'error' ); ?> id == $ath_calameo_credentials_page_hook ) { add_settings_error( $calameo_credentials, 'wp-calameo-not-installed', AthlonCalameoManageConfiguration::$WP_CALAMEO_NOT_INSTALLED_WARNING, 'error' ); } } /* Add contextual help tabs on calameo credentials page */ function ath_calameo_credentials_help_tabs () { global $ath_calameo_credentials_page_hook; $screen = get_current_screen(); /* * Check if current screen is My Admin Page * Don't add help tab if it's not */ if ( $screen->id != $ath_calameo_credentials_page_hook ) return; /* Add overview tab if current screen is My Admin Page*/ $screen->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '
' . __( 'On this page you can change the credentials that will be used to connect to the Calameo API.
Note that your API credentials should have at least commons and publish access rights.' ) . '
For more information :
Get Calameo API Key