Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis Admin Boxes Class
Tagged: 3.7.1, class, extension, Genesis_Admin_Boxes, upgrade
- This topic has 1 reply, 2 voices, and was last updated 11 years, 5 months ago by
tnorthcutt.
-
AuthorPosts
-
November 2, 2013 at 5:20 am #70472
saracup
MemberI am running Genesis 2.0.1 on a multisite installation. This is an in-house developed child theme for Genesis. The issue is with a plugin that uses the Genesis_Admin_Boxes class. The plugin was working fine until I upgraded to WordPress 3.7.1 from 3.6.1. It's on our development server, so I'm not too upset for now, but would like to know why the class is no longer working when it worked fine in WP 3.6.1, and is doing so on our production site (http://news.med.virginia.edu/medicinematters/) on which I have not yet upgraded. It's a simple admin page where a user selects from two options for search: Google or WordPress. Here is the code for the plugin that extends the class:
class UVASOMSEARCH_Settings extends Genesis_Admin_Boxes { /** * Create an admin menu item and settings page. * * @since 1.0.0 */ function __construct() { // Specify a unique page ID. $page_id = 'uvasomsearch'; // Set it as a child to genesis, and define the menu and page titles $menu_ops = array( 'submenu' => array( 'parent_slug' => 'genesis', 'page_title' => 'Search Settings ', 'menu_title' => 'Search Settings', 'capability' => 'manage_options', ) ); // Set up page options. These are optional, so only uncomment if you want to change the defaults $page_ops = array( // 'screen_icon' => array( 'custom' => WPS_ADMIN_IMAGES . '/staff_32x32.png' ), 'screen_icon' => 'options-general', // 'save_button_text' => 'Save Settings', // 'reset_button_text' => 'Reset Settings', // 'save_notice_text' => 'Settings saved.', // 'reset_notice_text' => 'Settings reset.', ); // Give it a unique settings field. // You'll access them from genesis_get_option( 'option_name', CHILD_SETTINGS_FIELD ); $settings_field = 'UVASOMSEARCH_SETTINGS_FIELD'; // Set the default values $default_settings = array( 'uvasomsearch_option' => 'google' ); // Create the Admin Page $this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings ); // Initialize the Sanitization Filter add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitization_filters' ) ); } /** * Set up Sanitization Filters * * See /lib/classes/sanitization.php for all available filters. * * @since 1.0.0 */ function sanitization_filters() { genesis_add_option_filter( 'no_html', $this->settings_field, array( 'uvasomsearch_option' ) ); } /** * Register metaboxes on Child Theme Settings page * * @since 1.0.0 * * @see Child_Theme_Settings::contact_information() Callback for contact information */ function metaboxes() { add_meta_box('uvasomsearch-settings', 'UVA SOM Site Search Options', array( $this, 'uvasomsearch_meta_box' ), $this->pagehook, 'main', 'high'); } /** * Register contextual help on Child Theme Settings page * * @since 1.0.0 * */ function help( ) { global $my_admin_page; $screen = get_current_screen(); if ( $screen->id != $this->pagehook ) return; $tab1_help = '<h3>' . __( 'Site Search Options' , '' ) . '</h3>' . '<p>' . __( 'Select the type of search this site will have. If this is a private site protected by NetBadge then select WordPress search. Public sites should use Google search (the default).' , '' ) . '</p>'; $screen->add_help_tab( array( 'id' => $this->pagehook . '-searchoptions', 'title' => __( 'Search Options' , '' ), 'content' => $tab1_help, ) ); } /** * Callback for Contact Information metabox * * @since 1.0.0 * * @see Child_Theme_Settings::metaboxes() */ function uvasomsearch_meta_box() { /*set default ranges for quantities of articles in */ $uvasomsearch_options = array( 'google' => 'Google Search (site is on the public web)', 'wordpress' => 'WordPress Search (site is private -- protected by UVA authentication)' ); //Display the form ?> <p><strong>Site Search Option:</strong><br /> <select name="<?php echo 'UVASOMSEARCH_SETTINGS_FIELD' ?>[uvasomsearch_option]"> <?php foreach ( $uvasomsearch_options as $type => $label ) : ?> <option value="<?php echo $type; ?>" <?php selected($type, $this->get_field_value( 'uvasomsearch_option')); ?>><?php _e($label, 'genesis'); ?></option> <?php endforeach; ?> </select> </p> <?php } } add_action( 'genesis_admin_menu', 'uvasomsearch_settings_menu' ); /** * Instantiate the class to create the menu. * * @since 1.8.0 */ function uvasomsearch_settings_menu() { new UVASOMSEARCH_Settings; }
The class extension is called in this manner:
require_once(dirname( __FILE__ ). '/uvasomsearch_options.php');
Any thoughts why this would break in 3.7.1 when it works in 3.6.1?
http://administration.emedicine.virginia.edu/November 17, 2013 at 1:06 pm #73642tnorthcutt
MemberWhen you say "no longer works", what exactly do you mean? Are there particular error messages you can post here?
Want to improve your freelancing business? I teach how to do that my blog and email list: travisnorthcutt.com.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.