• Resolved natetanic

    (@natetanic)


    Hello!

    I have custom shell scripts that will take my wordpress directory from my test server and tar it, download it, then deploy to the prod server. I then do a database dump (mysql), download it, then execute that on a fresh db in prod. The only difference between the two currently is the domain name, which I do a find/replace on the database dump. In theory, the two servers should be nearly identical, minus the domain.

    My issue is that when I load the prod login page, all my customizations in this plugin are gone. Upon inspection in the admin UI, no settings are saved at all. After inspecting the code and the db entries, it appears that the default settings are overwriting my imported db entries.

    Do you know why the install method is getting called upon first page load, even though all the values are populated in the db? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @natetanic

    I think the problem is that you did a simple replace.

    That won’t work on serialized data as that will mess up the data structure so the data can no longer be unserialized.

    To understand it better, here it is a basic example:

    $exampleData=array(
    'url'=>'https://example.com'
    );

    $serializedData = maybe_serialize($exampleData);
    echo $serializedData; // outputs: a:1:{s:3:"url";s:19:"https://example.com";}

    If you do a simple replace on this string and you check the output, e.g.:

    $updatedSerializedData = str_replace('example.com', 'somethingelse.com',$serializedData);
    echo $updatedSerializedData; // outputs: a:1:{s:3:"url";s:19:"https://somethingelse.com";}

    you will see that the length of the string s:19 no longer matches with the length of the new string, as it is no longer 19 character long but 25. So this:

    is not correct and if you try to unserialize it:

    maybe_unserialize($serializedData);

    the value will be false. To be able to unserialize the data, the string length needs to be updated accordingly from 19 to 25 as well:

    So if you really want to run replace in serialized data, too then you need to do that properly. But if you ask me, you should exclude our options in the {{wp_preffix}}_options table ( e.g. wp_options ). from this replacing completely. E.g. the option with the option_name:

    • nextend_social_login

    contains the settings of the plugin and the configurations of the individual plugins are stored in the options with the names like:

    • nsl_facebook
    • nsl_twitter
    • nsl_google

    so basically the pattern is like this nsl_{{providerID}}.

    The reason I suggest this is because, if your domain name changes, you will also have to modify the redirect URIs in the apps that you configured the providers of Nextend Social Login with, otherwise your social login apps won’t work with the new domains.
    Note: Even if you managed to replace the domain names in our configurations, that would just make us think that the URLs are fine – although they aren’t -, so we won’t even display the notification that warns you about that you have to modify the redirect URIs in your apps.

    Best regards,
    Laszlo.

    Thread Starter natetanic

    (@natetanic)

    Thank you so much for the reply! That was actually very helpful. I am not concerned about broken links or warnings, as I can fix them ad-hoc. I was able to rename my test subdomain to match the correct string length of the prod domain, so that worked out perfectly! Thanks again, cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.