• Resolved amurashkin17

    (@amurashkin)


    In the case of WP-Config Snippets, define statements recognized even if commented out. For example, if the file contains

    // define( ‘FORCE_SSL_ADMIN’, true );

    or

    /*
    define( ‘FORCE_SSL_ADMIN’, true );
    */

    the snippet checkbox is selected.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Aristocles

    (@apos37)

    Hello. You are correct, it doesn’t currently look for comments, but if deselect it and save it, it should remove the line entirely. As always, please review your config file before confirming just in case there is an issue, though. The snippets feature is still in BETA, so I am still making further updates. Thank you for letting me know. I will add this to my todo list on a future update. ??

    Plugin Author Aristocles

    (@apos37)

    @amurashkin, I just released a new update that fixes the issue. Please update and let me know if you need anything else. ??

    Thread Starter amurashkin17

    (@amurashkin)

    @apos37, here is what I found and what concerns I have about WP-CONFIG snippets.

    Observations

    In the interface, for each snippet, there is a short description on the left, a circle in the middle, and PHP statements on the right (with more explanation under them). The PHP statements font foreground color is

    • grey if the statements shown are from the original wp-config.php (DDT finds relevant statement)
    • rosy if the suggested statements shown (DDT cannot find relevant statements)

    Most circles are empty, few circles have check marks. The reason why the circles are checked is not clear – is it because DDT thinks that the snippet is already there or because DDT will apply the snippet?

    The grey statement matches the original statement. Why is the circle checked? The caching is enabled currently – does DDT assume that I want to disable it?

    The grey statements match the original statements. Why is the circle is checked? The memory limits are set to some values currently – does DDT assumes that I want to change them?

    This is different case than two above. The grey statement matches the original statement. The cron scheduler is already disabled – why then the circle is checked?

    The rosy statement does not matches the original statement that is define('WP_DEBUG', false);

    The resulting file has two WP_DEBUG statements

    define( 'WP_DEBUG', true ); <— in the DDT section
    define('WP_DEBUG', false); <— the original statement

    I have tried to add/remove spaces. I have copied the statement from the resulting file and changed true to false. I have copied the resulting statement as is (with true value). All to no avail – at the end, I got two true statements.

    The rosy statement matches the current statement define('WP_DEBUG_LOG', true); – why is it not grey? The original statement has a space after the comma.

    Recommendations

    Could you write some help text explaining the circle check mark meaning – does it mean that the snippet is already there or that the snippet will be applied? Maybe different marks for each case (one circle and one square:).

    If the original statements do not match the proposed statements – on the right side, for example, it would be nice to show the original statements (in grey) and proposed statements (in rosy).

    Please do not apply snippets unless they are explicitly selected. In my case, I explicitly checked only “Enable WP_DEBUG Mode” but had also 3 snippets selected by DDT, so got multiple settings changed.

    Here is, what I suspect, happened. I used DDT to apply 3 snippets and the file was changed. Then I restored the file from its backup. But DDT seems to keep the selected snippets in the database. So when I used DDT again, the snippets were already preselected. So when I selected 1 snippet, I got 4 snippets applied. The indication (3 check marks) was there, but I did not expect that.

    I see two ways to reduce user’s frustration in such a case

    • do not preselect snippets, show some indicator instead that the snippet was selected previously (for example, a different circle color without a check mark)
    • lock update button until the user resolves previously selected snippets – show different check mark (for example question mark) and allow user to click it until it is selected or not

    There are few more things that you might want to consider. wp-config.php file can be edited by other plugins and by users. The order of statements may be important. So some features to keep the file layout will be welcome.

    DDT already encloses its section in begin and end comments. So check if the section is there and, if so, do new changed in the section. It will allow users to have code before the section.

    An option to update existing statement in place (instead of moving it to DDT section) would be useful. Also an option to keep inline comments.

    Plugin Author Aristocles

    (@apos37)

    Hi @amurashkin, thank you for taking the time to write all that.

    In response, let’s start with the checkboxes. The way the wp-config tab currently works (and we can explore alternatives, absolutely!) is that the snippet checkboxes get checked if the plugin finds the snippet in the file regardless of the value, and regardless of spacing, case, and type of quotation marks. So whether you have define('WP_DEBUG_LOG', true) or define( "WP_DEBUG_LOG", FALSE ), it will still be checked. The text should always be grey if it is checked/found, and rosy if unchecked/not found. If this is not the case, then something is off. Overall you want to select what want on your file, and deselect what you don’t want on your file.

    The plugin does not save any information about what you have previously selected or what was on previous versions; unless a snippet is selected when you update it, it will not add it. The only thing I can think that happened is that when you restored the older version of the file, the page was not refreshed before trying again. Hopefully that was a one-off, but if it happens again, I’ll need more information and examples to replicate.

    As for the values, if the snippet is found in your file, it should show the value you have set, and if it’s not in your file then it will give a value that is commonly used as a default so that you can quickly add it. There is a filter (ddtt_wpconfig_snippets) that will allow you to change the default values if you wish. Instructions are on the hooks tab.

    I can certainly add some explanation to the page as requested. ?? Regarding placement of the snippets, I’ll have to think about that a little bit. As I mentioned before, this whole snippet thing is in BETA still, because until now nobody has come forward with any suggestions or concerns about it and I’ve had very little to go by. I wasn’t sure if anybody was actually using it to be honest. Lol. I use it regularly with my work managing about a dozen single sites and three multi-sites, so I have just used it how I see fit. I will definitely consider all of your recommendations and improve the functionality for everyone, though.

    By the way, I saw you joined my Discord server and didn’t post anything. I saw your account was new so maybe you were just unfamiliar with it and decided to respond here instead, which is fine. For your situation and with all of the recommendations you listed, it might be better/easier to chat there, though. Let me know if you’d like help with it.

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