Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author room34

    (@room34)

    Nicely done. This gives me an idea to add a way to export/import preferred settings as a simple hash, the way Wordfence does it.

    Thread Starter Erik Joling

    (@ejoling)

    I don’t know exactly how WordFence does it, but being able to export/import would be a welcome addition!

    I would suggest using the JSON format instead of a hash. That would make it more human-readable.

    Plugin Author room34

    (@room34)

    Good point about readability; depends on what the goal is ultimately though… the hash is not intended to be editable; it’s just a relatively short string of text to copy-paste from one installation to another.

    Thread Starter Erik Joling

    (@ejoling)

    Good point yourself ?? The usecase for JSON would be to able to easily share a configuration and change some settings directly in the code before importing it. Might be an edgecase though.

    Plugin Author room34

    (@room34)

    Yeah… now I’m thinking of this more in terms of how Advanced Custom Fields uses JSON for import/export of field groups. I think that does make sense as the way to approach this. I think it makes sense as a natural extension of what I’m already doing with hooks. Thanks again for the suggestion! I will add this to the project to-do list.

    Plugin Author room34

    (@room34)

    OK… version 3.2.0 will be available momentarily. It adds a third tab to the admin page, “Import/Export”, using a JSON format to allow you to copy your settings, make edits in a text editor if needed, and paste your settings in to make bulk changes.

    There are multiple layers of validation/sanitization to reject any input that is not valid JSON, force all values to be integers, and to skip any data that is not No Nonsense entries. (This could be polished up a bit in the future, but for now it should be adequate to avoid any malicious or accidental misuse.)

    Thread Starter Erik Joling

    (@ejoling)

    Haha, you’re fast! It looks good. I took it for a simple test-spin and the import worked as expected.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘My custom utility to easily set preferred options’ is closed to new replies.