$message"; } /** * Callback function for displaying admin messages * * @return calls blogBox_show_msg() */ function blogBox_admin_msgs() { // check for our settings page - need this in conditional further down if(isset($_GET['page'])){ $blogBox_settings_pg = strpos($_GET['page'], 'blogBox-settings'); } else { $blogBox_settings_pg = FALSE; } // collect setting errors/notices: //http://codex.wordpress.org/Function_Reference/get_settings_errors $set_errors = get_settings_errors(); //display admin message only for the admin to see, only on our settings page and only when setting errors/notices are returned! if(current_user_can ('manage_options') && $blogBox_settings_pg !== FALSE && !empty($set_errors)){ // have our settings succesfully been updated? if($set_errors[0]['code'] == 'settings_updated' && isset($_GET['settings-updated'])){ blogBox_show_msg("

" . $set_errors[0]['message'] . "

", 'updated'); // have errors been found? }else{ // there maybe more than one so run a foreach loop. foreach($set_errors as $set_error){ // set the title attribute to match the error "setting title" - need this in js file blogBox_show_msg("

" . $set_error['message'] . "

", 'error'); } } } } add_action('admin_notices', 'blogBox_admin_msgs'); /** * Globalize the variable that holds * the Settings Page tab definitions * * @global array Settings Page Tab definitions */ global $blogBox_tabs; $blogBox_tabs = blogBox_get_settings_page_tabs(); /** * Call add_settings_section() for each Settings * * Loop through each Theme Settings page tab, and add * a new section to the Theme Settings page for each * section specified for each tab. * * @link http://codex.wordpress.org/Function_Reference/add_settings_section Codex Reference: add_settings_section() * * @param string $sectionid Unique Settings API identifier; passed to add_settings_field() call * @param string $title Title of the Settings page section * @param callback $callback Name of the callback function in which section text is output * @param string $pageid Name of the Settings page to which to add the section; passed to do_settings_sections() */ foreach ( $blogBox_tabs as $tab ) { $tabname = $tab['name']; $tabsections = $tab['sections']; foreach ( $tabsections as $section ) { $sectionname = $section['name']; $sectiontitle = $section['title']; // Add settings section add_settings_section( // $sectionid 'blogBox_' . $sectionname . '_section', // $title $sectiontitle, // $callback 'blogBox_sections_callback', // $pageid 'blogBox_' . $tabname . '_tab' ); } } /** * Callback for add_settings_section() * * Generic callback to output the section text * for each Plugin settings section. * * @uses blogBox_get_settings_page_tabs() Defined in /functions/options.php * * @param array $section_passed Array passed from add_settings_section() */ function blogBox_sections_callback( $section_passed ) { global $blogBox_tabs; $blogBox_tabs = blogBox_get_settings_page_tabs(); foreach ( $blogBox_tabs as $tabname => $tab ) { $tabsections = $tab['sections']; foreach ( $tabsections as $sectionname => $section ) { if ( 'blogBox_' . $sectionname . '_section' == $section_passed['id'] ) { ?>

/> value="" />