WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Options keep resetting with no reason (32 posts)

  1. gelatomyway
    Member
    Posted 1 year ago #

    [ Moderator note: don't use block quote for that, use the code button or backtick instead. ]

    Hello,

    I'm running a WordPress multisite ver 3.5.0 .
    I created 2 sites; in one I installed subscribe2 ver 8.7 with an italian language localization and activated it.

    Everythig looks fine but the options keep resetting themselves to the english defaults.

    I tried the reset (repair) function in the options page and it actually resets everything to defaults BUT actually (correctly in my opinion) translating the Templates settings to italian language.

    If i leave these settings, after a while, I find the settings reverted back to the english defaults.
    There is no way to keep the defaults from changing.

    I then looked out in my sql database for Subscribe2 options records.

    Mine are inside WP_2_options . The serialized record , before reset/restore is the following:

    a:40:{s:7:"autosub";s:2:"no";s:15:"newreg_override";s:2:"no";s:8:"wpregdef";s:2:"no";s:10:"autoformat";s:7:"excerpt";s:12:"show_autosub";s:3:"yes";s:11:"autosub_def";s:3:"yes";s:12:"comment_subs";s:2:"no";s:11:"comment_def";s:2:"no";s:17:"one_click_profile";s:2:"no";s:8:"bcclimit";i:1;s:11:"admin_email";s:4:"subs";s:8:"tracking";s:0:"";s:6:"s2page";i:0;s:10:"stylesheet";s:3:"yes";s:5:"pages";s:2:"no";s:8:"password";s:2:"no";s:8:"stickies";s:2:"no";s:7:"private";s:2:"no";s:10:"email_freq";s:5:"never";s:10:"cron_order";s:4:"desc";s:10:"compulsory";s:0:"";s:7:"exclude";s:0:"";s:6:"sender";s:1:"1";s:12:"reg_override";s:1:"1";s:9:"show_meta";s:1:"0";s:11:"show_button";s:1:"1";s:4:"ajax";s:1:"0";s:6:"widget";s:1:"0";s:13:"counterwidget";s:1:"0";s:14:"s2meta_default";s:1:"0";s:7:"entries";i:25;s:6:"barred";s:0:"";s:15:"exclude_formats";s:0:"";s:8:"mailtext";s:215:"{BLOGNAME} has posted a new item, '{TITLE}'
    
    {POST}
    
    You may view the latest post at
    {PERMALINK}
    
    You received this e-mail because you asked to be notified when new updates are posted.
    Best regards,
    {MYNAME}
    {EMAIL}";s:20:"notification_subject";s:20:"[{BLOGNAME}] {TITLE}";s:13:"confirm_email";s:229:"{BLOGNAME} has received a request to {ACTION} for this email address. To complete your request please click on the link below:
    
    {LINK}
    
    If you did not request this, please feel free to disregard this notice!
    
    Thank you,
    {MYNAME}.";s:15:"confirm_subject";s:40:"[{BLOGNAME}] Please confirm your request";s:12:"remind_email";s:348:"This email address was subscribed for notifications at {BLOGNAME} ({BLOGLINK}) but the subscription remains incomplete.
    
    If you wish to complete your subscription please click on the link below:
    
    {LINK}
    
    If you do not wish to complete your subscription please ignore this email and your address will be removed from our database.
    
    Regards,
    {MYNAME}";s:14:"remind_subject";s:34:"[{BLOGNAME}] Subscription Reminder";s:7:"version";s:3:"8.7";}

    The serialized record after reset/restore is:

    :40:{s:7:"autosub";s:2:"no";s:15:"newreg_override";s:2:"no";s:8:"wpregdef";s:2:"no";s:10:"autoformat";s:7:"excerpt";s:12:"show_autosub";s:3:"yes";s:11:"autosub_def";s:3:"yes";s:12:"comment_subs";s:2:"no";s:11:"comment_def";s:2:"no";s:17:"one_click_profile";s:2:"no";s:8:"bcclimit";i:1;s:11:"admin_email";s:4:"subs";s:8:"tracking";s:0:"";s:6:"s2page";i:0;s:10:"stylesheet";s:3:"yes";s:5:"pages";s:2:"no";s:8:"password";s:2:"no";s:8:"stickies";s:2:"no";s:7:"private";s:2:"no";s:10:"email_freq";s:5:"never";s:10:"cron_order";s:4:"desc";s:10:"compulsory";s:0:"";s:7:"exclude";s:0:"";s:6:"sender";s:8:"blogname";s:12:"reg_override";s:1:"1";s:9:"show_meta";s:1:"0";s:11:"show_button";s:1:"1";s:4:"ajax";s:1:"0";s:6:"widget";s:1:"0";s:13:"counterwidget";s:1:"0";s:14:"s2meta_default";s:1:"0";s:7:"entries";i:25;s:6:"barred";s:0:"";s:15:"exclude_formats";s:0:"";s:8:"mailtext";s:241:"{BLOGNAME} presenta un nuovo intervento, '{TITLE}'
    
    {POST}
    
    Puoi leggere l'ultimo articolo su
    {PERMALINK}
    
    Hai ricevuto questa e-mail perché hai chiesto di essere notificato quando vengono fatti degli aggiornamenti.
    Grazie,
    {MYNAME}
    {EMAIL}";s:20:"notification_subject";s:20:"[{BLOGNAME}] {TITLE}";s:13:"confirm_email";s:224:"{BLOGNAME} ha ricevuto una richiesta di {ACTION} per questo indirizzo e-mail. Per completare la procedura clicca sul link sottostante:
    
    {LINK}
    
    Se non hai effettuato alcuna richiesta, ignora questa e-mail.
    
    Grazie,
    {MYNAME}.";s:15:"confirm_subject";s:38:"[{BLOGNAME}] Conferma la tua richiesta";s:12:"remind_email";s:324:"Questo indirizzo e-mail è stato iscritto per ricevere notifiche via e-mail da {BLOGNAME} ({BLOGLINK}) ma la procedura non è stata completata.
    
    Se vuoi confermare la tua iscrizione clicca sul link sottostante:
    
    {LINK}
    
    Altrimenti, ignora questa e-mail e il tuo indirizzo sarà rimosso dal nostro database.
    
    Saluti,
    {MYNAME}";s:14:"remind_subject";s:34:"[{BLOGNAME}] Promemoria iscrizione";s:7:"version";s:3:"8.7";}

    Where is the problem??

    Thanks
    Best Regards
    Luca R.

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

  2. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I don't use Multisite myself but even so I'm not sure why this would happen. The settings are created when the code detects that it isn't installed. This may happen if there is a failure in the connection to the database but if that were the case the creation of new settings should fail also.

    Without a much greater understanding of why this is happening on your site I cannot offer an explanation or a fix.

  3. gelatomyway
    Member
    Posted 1 year ago #

    @mattyrob

    I'm sorry I used "b-quote" instead of "code" buttons above.

    I'm trying to narrow the problem down.

    I have a multisite installation that has one "root" site and two "child" sites, one for italian and one for english languages.

    The "root" site contains a one line of code theme that detects user language and redirects to either of the two "child" sites.

    I installed and activated Subscribe2 in the "root" site as required by wordpress multisite.
    I then installed Subscribe2 in the italian language site and immediately experienced the problem.

    After Your answer, I activated Subscribe2 also in the english site.

    I then first cheched that the Subscribe2_option records are in the right places. I'm not a wordpress programmer nor a php programmer but I understood that each "site" has a specific site database option name, so I have:

    wp_options -> "root" site options database
    wp_2_options-> "italian" site options database
    wp_3_options->"english" site options database

    all 3 carry a subscribe2_options record.

    By manually updating the subscribe2_options sql records I see that each site loads and shows the correct options in the settings pages.

    Now the following is happening:

    "root" site options never change
    "english" and "italian" site options change automatically after a while and they get the same "root" values.

    Here is my guess:
    some code in the cron queue is updating options in the 3 sites at every execution of cron. While the options are saved in the correct tables (I have all 3 updated), it's the LOAD of the actual options at the start of every "site" execution of cron code that is always getting values from "root" and not from each "site".

    If we don't find a solution, I'll have to quit using this nice plugin.

    Thanks
    Best Regards
    Luca R.

  4. gelatomyway
    Member
    Posted 1 year ago #

    Hello,

    I see the following code in class-s2-core.php

    /**
    	Send a daily digest of today's new posts
    	*/
    	function subscribe2_cron($preview = '', $resend = '') {
    		if ( defined('DOING_S2_CRON') && DOING_S2_CRON ) { return; }
    		define( 'DOING_S2_CRON', true );
    		global $wpdb, $post;
    
    		if ( '' == $preview ) {
    			// update last_s2cron execution time before completing or bailing
    			$now = current_time('mysql');
    			$prev = $this->subscribe2_options['last_s2cron'];
    			$last = $this->subscribe2_options['previous_s2cron'];
    			$this->subscribe2_options['last_s2cron'] = $now;
    			$this->subscribe2_options['previous_s2cron'] = $prev;
    			if ( '' == $resend ) {
    				// update sending times provided this is not a resend
    				update_option('subscribe2_options', $this->subscribe2_options);
    			}

    is this last line update_option function updating all the options record at once at every cron call?

    Thank Yo
    Luca R.

  5. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I'm not 100% sure about this, as I said before I don't use multisite, but disable the 'root' instance of Subscribe2 and just leave it active on the "Italian" and "English" sub sites and see if that helps. I'll have a look through the multisite code and see if I can think of a way this may be happening.

    That code you've found only updates 2 parts of the overall serialized settings array if you are also using the code in digest mode. It doesn't reset or update the entire settings value again.

  6. gelatomyway
    Member
    Posted 1 year ago #

    Hello,

    I tried to disable Subscribe2 on "root" but it does'nt work.

    There's no way I can keep the options at their place.

    I'm sorry but I deleted Subscribe2 form my install.

    Thank You
    Best regards
    Luca R.

  7. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I have not had any other reports of this on Multisite installs. If you've deleted, I guess we'll never know why this happened.

  8. gelatomyway
    Member
    Posted 1 year ago #

    Hello,

    I understood You have no way to help me.

    I can always reinstall if You give me intructions about what should I check...

    Best regards
    Luca R.

  9. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Try starting with this if you have the time to bug hunt. Upload the Subscribe2 code and activate it on just the "Italian" blog. Does it reset to English on there?

    Also, are you using a gettext translation into Italian for the entire plugin on this sub-blog?

  10. gelatomyway
    Member
    Posted 1 year ago #

    Hello,

    I reinstalled Subscribe2 strictly following the Subscribe2 instrucions page, downloading and applying the plugin from the "network administrator" panel in wordpress.
    I have now Subscribe2 V8.8 installed.

    I then activated Subscribe2 plugin only in the "italian" site.
    I did not ftp-upload any language file as I did with V8.7 (subscribe2-it_IT.mo file I fond somwhere on the web).

    The following happened:

    1) In the "italian" site the settings page was already populated with the last settings of V8.7 . This means only that the Subscribe2 option records were not automatically deleted at the previous uninstall of V8.7.

    2) I then changed some settings around with fresh values and they (in the last hour) apparently held. Previously , it did not hold values more than 5 min.

    These components are installed:
    Theme ElegantThemes Aggregate 2.9
    Plugins Social Media Widget 3.2 , JetPack 2.1.2

    Tell me the next step; I suggest to activate Subscribe2 on the english site and see if it holds settings and then, only afterwards, add the italian translation.

    Is there a suggested source for the correct italian translation files?
    I can also Poedit it if required.

    Thank You
    Best Regards
    Luca R.

  11. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Okay, so far so good. If the settings are remaining the same if the code is enabled only on the Italian site then I think it is time to take the next step.

    You can either enable on the English site OR apply the Italian language changes. Luckily enough another plugin user has made their translation efforts available within the last few hours.

    http://plugins.trac.wordpress.org/browser/subscribe2/i18n/it_IT/8.8

    I would suggest trying the translation first and if everything remains okay with that, then enable on the English site.

  12. gelatomyway
    Member
    Posted 1 year ago #

    @Mattyrob

    I did the following:

    1) dropped the italian translation in the plugin/subscribe2/ directory.

    2) Checked that the italian translation was active in the dasboard.

    3) Reset of subscribe2 to default settings by pressing the reset button

    4) verified that settings held ok.

    5) activated subscribe2 plugin in "english" site.

    At this point the problem occurred again.

    I observe this:
    a) in the "english" site everything is reset to english language.
    b) in the "english" site , under "appearance" tab, the "set default subscribe2 page at" option lists only a "sample page" item. I have no pages named "sample page" and the dropdop list lacks all the pages I have in the site.
    c) in the "italian" site all the themplates in the themplates tab reverted to english language.
    d) in the "italian" site , under "appearance" tab, the "set default subscribe2 pag at" option is set to the first page of the site pages and no more to the one I choose.
    e) in the "italian" site the dashboard text regarding subscribe2 is still in italian.

  13. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I wonder if this is something to do with the language file? Can you try again but miss the language file out this time?

  14. gelatomyway
    Member
    Posted 1 year ago #

    @Mattyrob,

    I just deleted the subscribe2-it_IT.mo file and changed some settings in subscribe2.
    No improvements.
    Same beaviour, settings are automatically cloned from "english" site to "italian" site in a matter of a few minutes.

    Note the following:

    1) Subscribe2 plugin is disabled in "root" site, so now apparently options are cloned from "english" site instead of "root".

    2) Under "email settings" tab, the option "send email from." is correctly kept to the right value in both sites, "italian" and "english". Previously, it was messed up like the other settings.

    3) Creation order of the 3 sites is "root","italian", "english"

    Do You want me to uninstall and reinstall Subscribe2 but miss the italian file?

  15. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Yes, give that a try, you may need to access the updated uninstaller here:

    http://plugins.svn.wordpress.org/subscribe2/trunk/uninstall.php

  16. gelatomyway
    Member
    Posted 1 year ago #

    @MattyRob

    I FTP udated uninstall.php, even if appeared to be exactly the same as the one You suggested.

    I then "deactivate"d subscribe2 from every site and finally "delete"d it from the dashboard.

    I installed again Subscribe2 (v8.8) from the dashboard (automatic download and install).

    I activated Subscribe2 in both sites, "italian" and "english"

    I made a reset of both.

    It DOES'NT work, it keeps resetting itself messing up the settings.

    I confirm that it's still missing to enumerate the pages in the "english" site in the "Set default Subscribe2 page to:" setting. I have some pages but none of them is listed, just a "sample page" setting is there but I have no pages with such a name.

    While the "send email from" setting is correctly set to both sites. I did not have to change it, this makes me suspect that none of the previous options was deleted from the sql database during uninstall.

  17. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I'm going to try an replicate your site set up, are you using sub-domain or sub-folder? Also, how do you specify a language per sub-site?

  18. gelatomyway
    Member
    Posted 1 year ago #

    @Mattirob

    Hello,

    I have a Mutisite 3.5 , with italian language option, subfolder installation with this structure:
    / (root)
    /it/
    /en/

    I acutually have test pages in the english version and a working site in the italian version.

    You can access all by linking directly to:

    http://www.gelatomyway.com
    http://www.gelatomyway.com/it/
    http://www.gelatomyway.com/en/

    Download WordPress Multisite V3.5 here:

    http://it.wordpress.org/wordpress-3.5-it_IT.zip

    Note: Ver 3.5.1 was not available at time of first installation.

    The "root" site is a simple redirector to the other two sites based on the client browser preferred language.
    I changed the default theme with a simple "redirect" theme made of just two files containig publicly available code:

    Style.css

    /*
    Theme Name: Redirect
    Theme URI: http://wordpress.org/extend/themes/redirect
    Author: AB-WebLog.com
    Author URI: http://www.ab-weblog.com
    Description: Redirects
    Version: 1.0
    Tags: redirect
    */

    and index.php

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * E.g., it puts together the home page when no home.php file exists.
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Redirect
     */
    
    /**
     * Detect browser language.
     *
     * @param array $allowed_languages An array of languages that are available on the site.
     * @param string $default_language Default language to use if none could be detected.
     * @param string $lang_variable Custom user language support. If not specified $_SERVER['HTTP_ACCEPT_LANGUAGE'] is used.
     * @param string $strict_mode If true (default) the whole language code ("en-us") is used and not only the left part ("en").
     * @return string The detected browser language.
     */
    function get_lang_from_browser($allowed_languages, $default_language, $lang_variable = NULL, $strict_mode = TRUE) {
        // Use $_SERVER['HTTP_ACCEPT_LANGUAGE'] if no language variable is available
        if (NULL === $lang_variable)
            $lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
    
        // Any info sent?
        if (empty($lang_variable))
            return $default_language;
    
        // Split the header
        $accepted_languages = preg_split('/,\s*/', $lang_variable);
    
        // Set default values
        $current_lang = $default_language;
        $current_q    = 0;
        // Now work through all included languages
        foreach ($accepted_languages as $accepted_language) {
            // Get all info about this language
            $res = preg_match(
                '/^([a-z]{1,8}(?:-[a-z]{1,8})*)'.
                '(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
                $accepted_language,
                $matches
            );
    
            if (!$res)
                continue;
    
            // Get language code and split into parts immediately
            $lang_code = explode('-', $matches[1]);
    
            // Is there a quality set?
            if (isset($matches[2]))
                $lang_quality = (float)$matches[2];
            else
                $lang_quality = 1.0;
    
            // Until the language code is empty...
            while (count($lang_code)) {
                // Check if the language code is available
                if (in_array(strtolower(join('-', $lang_code)), $allowed_languages)) {
                    // Check quality
                    if ($lang_quality > $current_q) {
                        $current_lang = strtolower(join('-', $lang_code));
                        $current_q = $lang_quality;
                        break;
                    }
                }
                // If we're in strict mode we won't try to minimalize the language
                if ($strict_mode)
                    break;
    
                // Cut the most right part of the language code
                array_pop($lang_code);
            }
        }
    
        return $current_lang;
    }
    
    $allowed_langs = array('en', 'it');
    $lang = get_lang_from_browser($allowed_langs, 'en', NULL, FALSE);
    header('Location: http://' . $_SERVER['HTTP_HOST'] . "/$lang/");
    
    exit();
    ?>

    To create the sites You use the Sites->Add new command form the Network administrator dashboard in wordpress 3.5 ,then You just set the language using each site dashboard.

    These components are installed:
    Theme ElegantThemes Aggregate 2.9
    Plugins Social Media Widget 3.2 , JetPack 2.1.2

  19. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Okay, I have re-produced the issue. For some reason the update_option call is failing at the end of the upgrade code and as such the version number is missing. This results in the upgrade code being called on every page load which results in the options being reset.

    That's as far as I am at the moment, now I need to figure out why the update_option function call fails.

  20. gelatomyway
    Member
    Posted 1 year ago #

    @Mattyrob

    I'm VERY glad You narrowed it down!! :)

  21. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    It's getting weirder the more I investigate so you may need to bear with me a while. ;)

  22. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Good news, I think I have a fix! Get the file from this location:

    http://plugins.svn.wordpress.org/subscribe2/trunk/classes/class-s2-multisite.php

    And replaced the file of the same name on your server at:
    wp-content/plugins/subscribe2/classes/

    that should fix this issue for you.

  23. gelatomyway
    Member
    Posted 1 year ago #

    @Mattyrob,

    ****W*O*R*K*S*!*!****

    You fixed it!

    If You ever come to Italy we'll prepare a perfect genuine italian gelato for You, any flavour, shape, or size, just contact me!!!

    Will You incorporate this fix in the next Subscribe2 release?

    Thank You VERY much!

    Best Regards
    Luca R.

  24. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    Excellent, and thanks for confirming the fix. This is already committed for future releases of Subscribe2.

    I've been to Italy a few times, there is not better ice cream in the world :) If I knew where in Italy you were I'd be very tempted to take you up on that offer!!

  25. gelatomyway
    Member
    Posted 1 year ago #

    @Mattyrob

    Hello,

    I have a new problem.

    Settings are correctly retained in both sites.

    I'm now activating the registration pages and the following happens:

    I have a "Subcribe" site page that lists correctly the subscribe2 subscription form.

    When a user types it's email and confirms, he is redirected, to the very same page (as it is supposed to work) that asks to check email and confirm subscription and this is perfectly ok.

    Now, if a user clicks on the link received by email, he is redirected to the "subscribe" web page (and this is still correct), but the same page lists a mix of the correct page (subscription confirmation) and the registration page (subscription form).

    In the "subscription confirmed" page I see:

    On top "Subscription Confirmation"
    and below the "Your email:","enter your email address.." , "subscibe" and "unsubscribe" buttons, where, instead it should show the "You have successfully subscribed" message.

    The user email is correctly registered end condirmed in Subscribe2 database as it shoes up in the "current subscribers" list.

    You can check it by subscribing here

    http://www.gelatomyway.com/en/subscribe/

    Previously to the "options" fix it was working correctly; I decided to post here since I suspect this is related to the first fix.

  26. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I don't think that will be linked to the recent fix because the code for these two things are in different files. I'll see if I can re-produce on my test site later.

  27. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    I've tested this on my development install using a core WordPress theme and it works fine for me. It may be an issue with your theme.

    Try reverting to one of the core WordPress themes and see if this issue persists. If it doesn't we need to look at the theme (or change it), if it doesn't fix the issue it's going to take some further investigating.

  28. gelatomyway
    Member
    Posted 1 year ago #

  29. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @Luca,

    As from that same thread then, please can you use a core WordPress theme and see if the issue persists. I need to narrow down where I'm looking.

  30. gelatomyway
    Member
    Posted 1 year ago #

    @Nattyrob,

    I got it!

    It's the wordpress "jetpack" plugin.

    I did the following test:

    I created a new site under the network section in worpress.

    I started with the twentytwelve theme and subscribe2 activated. Subscribe2 works ok.

    I activated "Social Media Widget V3.2".
    Subscribe2 works ok.

    I Changed theme to "AlegantThemes Aggregates".
    Subscribe2 works ok.

    I Turned on "Jetpack 2.1.2" (actual version).
    Subscribe2 shows the problem above .

    I Changed theme to "twentytwelve ".
    Subscribe2 shows the problem above .

    I Turned off "Social Media Widget V3.2".
    Subscribe2 shows the problem above .

    So it's the Jetpack Plugin. There should be some kind of conflict between jetpack and subscribe2.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic