WordPress.org

Ready to get started?Download WordPress

Forums

Twitget
[resolved] Options not saving. (5 posts)

  1. NomadCF
    Member
    Posted 11 months ago #

    So I think this might be a wordpress options saving bug. But I've only encountered it with twitget. So here's what happened, during a "save" of my twitget settings. I saw that the data entry (option_value) that was saved to the database only had value (option_value) of "1". Nothing more and nothing less just simply the value of 1. And once this happened nothing would have save/update, regardless of that option(s) you changed. Now once I did a DELETE (DELETE FROM wp_options WHERE option_name="twitget_settings";). Everything started to work again. Now so far I've have this happen on 2x of my 8 wordpress sites. And it's easy enough to fix. But I can't seem to track down what is causes it in the first place. I've even tried adding in a delete_option before the update. But that has also failed. Once that value is "1", WordPress seems incapable of dealing with that eatery (option and value) ever again.

    http://wordpress.org/extend/plugins/twitget/

  2. Boštjan Cigan
    Member
    Plugin Author

    Posted 11 months ago #

    Thank you for reporting it. However I myself have also been tracking this bug, it happens to some people (rare occasions) but not all of them. Currently I have no idea where this happens. If you have more data what you were doing at the time, I'd be very happy.

    Cheers.

  3. NomadCF
    Member
    Posted 11 months ago #

    Found a fix, while I still haven't found the true root of the issue heres what I have. And a fix.

    At some point

    $twitget_settings
    is getting set to
    1
    . And once this is done you can not then make
    $twitget_settings
    an array with out either unsetting it or redeclaring it.

    In other words by the time you start trying to set your vars like
    $twitget_settings['twitter_username'] = stripslashes($_POST['twitget_username']);

    You can't because it's already declared as an int (1), So the fallowing code adjusts for this.

    Change

    function twitget_settings() {
    
                    $twitget_settings = get_option('twitget_settings');
                    $message = '';

    to

    function twitget_settings() {
    
                    $twitget_settings = get_option('twitget_settings');
                    $message = '';
                    if ( is_array($twitget_settings) === false ) {
                     unset($twitget_settings);
                    }
  4. Boštjan Cigan
    Member
    Plugin Author

    Posted 10 months ago #

    Thank you! I've added the solution in the new plugin version as well.

    Cheers!

  5. NomadCF
    Member
    Posted 10 months ago #

    Glad I could help!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.