WordPress.org

Forums

Genesis Simple Sidebars
SS_SETTINGS_FIELD is not properly instantiated (3 posts)

  1. Andrew Nacin
    Lead Developer
    Posted 3 years ago #

    Activate Genesis and Genesis Simple Sidebars. Go to the widgets screen. You'll find a sidebar called "_".

    The issue is with how SS_SETTINGS_FIELD is instantiated. See admin.php:

    add_option(SS_SETTINGS_FIELD, '__return_empty_array', '', 'yes');

    That makes the value of the option actually be '__return_empty_array'. When this is later fetched with $info['name'], PHP converts this to $info[0], or the first character of the string, and you end up with _.

    Patch (which won't work until the pageload following, since widgets_init runs before admin_init) —

    Index: genesis-simple-sidebars/admin.php
    ===================================================================
    --- genesis-simple-sidebars/admin.php	(revision 472493)
    +++ genesis-simple-sidebars/admin.php	(working copy)
    @@ -5,7 +5,9 @@
     add_action('admin_init', 'register_ss_settings');
     function register_ss_settings() {
     	register_setting(SS_SETTINGS_FIELD, SS_SETTINGS_FIELD);
    -	add_option(SS_SETTINGS_FIELD, '__return_empty_array', '', 'yes');
    +	$option = get_option( SS_SETTINGS_FIELD );
    +	if ( false === $option || '__return_empty_array' == $option )
    +		update_option( SS_SETTINGS_FIELD, array() );
     }
    
     /**

    http://wordpress.org/extend/plugins/genesis-simple-sidebars/

  2. Gary Jones
    Member
    Posted 3 years ago #

    Will that patch still work if another sidebar has been added in the meantime? $option won't be false, and won't just be that string.

  3. Andrew Nacin
    Lead Developer
    Posted 3 years ago #

    Not sure, depends on what happens to SS_SETTINGS_FIELD on save. I'm sure Nathan could track it down.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Genesis Simple Sidebars
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.