• Resolved Bolder Elements

    (@hystericallyme)


    I upgraded my development server to the latest test release of 4.2 to ensure my plugins would continue working but I hit quite the roadblock. I read through the changelog but could not find what I was looking for.

    For all my of my plugins using the get_option and update_option functions, my settings are virtually wiped. All of my forms were blank. I thought maybe the upgrade patch (on network site) might have wiped the data. So I attempted to create new data, and nothing happened. Everything is still blank and the ‘get_option’ function always returns NULL.

    Did I miss something? Everything on my 4.1.2 setup works perfectly.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Bolder Elements

    (@hystericallyme)

    I started debugging WordPress and quickly realized I was too general before. It is not ALL get or update options, only those I use and set within a table.

    So much of my settings pages are placed within a class where I have extended WP_List_Table. I assign several variables within this class using the get_option function. The problem turns out to be the variable $this. If I add the following code to my constructor:

    var_dump( $this );

    I do not receive the class for my WP_List_Table extension but rather another class from another plugin: WooCommerce. What I cannot figure out is why. Why does the constructor no longer point to itself after I upgraded WordPress?

    class My_List_Table extends WP_List_Table {
    
        public $my_list_table_var;
    
        function __construct(){
            global $status, $page;
    
            //Set parent defaults
            parent::__construct( array(
                'singular'  => 'zone',
                'plural'    => 'zones',
                'ajax'      => false
            ) );
    
            // Does not return proper object
            var_dump($this);
    
            $this->my_list_table_var = get_option( 'my_list_custom_data' );
            var_dump($this->my_list_table_var ); // Returns NULL
        }
    }

    If I dump the return value for get_option there is no problem. It is simply when using the $this variable.

    Moderator Marius L. J.

    (@clorith)

    Hi,

    This sounds like a plugin conflict more than anything else, have you tested if everything works without WooCommerce enabled?

    Thread Starter Bolder Elements

    (@hystericallyme)

    Well my plugins are dependent on WooCommerce so I created list to test your theory. Sure enough it works separately from WooCommerce, even with the plugin enabled, it just cannot appear on a WooCommerce page. Not sure what changed but hopefully they do.

    Sorry for the trouble but I appreciate the quick response!

    Moderator James Huff

    (@macmanx)

    Have you tried the final release of 4.2 yet?

    WordPress 4.2 “Powell”

    On a side note, 4.2 RC 4 was released before you posted this support thread. When testing pre-release builds, please always make sure you’re on the latest. There were quite a few bug fixes between RC 1 and RC 4.

    Thread Starter Bolder Elements

    (@hystericallyme)

    Thank you, yes I had actually been keeping up to date (after thought) but I did figure out the problem. Poor coding in the end. Perhaps I missed it in the changelog or perhaps it isn’t a big deal if you do it right the first time.

    The Problem: A couple variables I assigned via $this were not predefined at the beginning of the class. I guess it wasn’t an issue before but now it is so the error was never caught on my end prior to 4.2 (I have tried the official release, had the same requirement).

    When you over stress you miss the most obvious things ??

    Moderator James Huff

    (@macmanx)

    Thanks for letting us know what it was! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘4.2 RC1 Changes with get/set option?’ is closed to new replies.