Skip to content

xwp/wp-settings-revisions

Repository files navigation

Settings Revisions

Keep revisions of changes to your settings in Theme Customizer, and preview rollbacks to their previous states.

Contributors: x-team, westonruter, kucrut
Tags: customizer, customize, options, settings, theme-mods, revisions, versioning, revert, styles
Requires at least: 3.7
Tested up to: 3.8
Stable tag: trunk (master)
License: GPLv2 or later

Description

Now compatible with PHP≥5.2!

One of the greatest features of WordPress is the Customizer which allows you to change settings and preview them in real-time, all before you publish them for everyone to see. (Go ahead and click that big Customize Your Site button on your Dashboard!) But what if you make a change and want to go back in time to restore your previous settings? Changes to posts can be previewed (mostly), and they have revisions which allow you to revert the current version to restore a previous one. The same revision system is needed for settings. This is what the Settings Revisions plugin implements.

In the Customizer, a new section appears at the top called “Settings Revision” and inside of it appears a dropdown of all revisions in the system, showing when they were made, who made them, and what changes were made. A text field appears below which allows users to supply a commit message.

Once installed, also check out the Widget Customizer plugin which brings sidebars and widget form controls into the Customizer, allowing you to edit widgets and preview them just like you do for any other settings in the Customizer. With the Settings Revisions and Widget Customizer plugins combined, you get widget revisions. Also try Settings Revisions with the Styles plugin.

You can access the Customizer by clicking the “Customize Your Site” button on your Dashboard, by accessing the Appearance > Customize menu item in the admin, or on the front-end of your site by clicking the “Customize” sub-menu item in the admin bar. You can also install the Customizer Everywhere plugin which makes the Customizer more accessible and integrates it with post previewing.

Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.

Build Status

Screenshots

Collapsed customizer section

Collapsed customizer section

Expanded customizer section

Expanded customizer section

Open dropdown of revisions

Open dropdown of revisions

Change setting starts new revision

Change setting starts new revision

Revision select during save

Revision select during save

New revision prepended to list

New revision prepended to list

Selecting previous revision loads old settings into customizer for preview before saving

Selecting previous revision loads old settings into customizer for preview before saving

Confirmation when restoring revision atop unsaved changes

Confirmation when restoring revision atop unsaved changes

Changelog

0.3

  • Remove ability to add new revision posts in admin. Fixes (#30). Props kucrut.
  • Only update a non-scalar setting's value if it has not changed according to _.isEqual. Props westonruter.
  • Serialize all values (even strings) when saving settings; this ensures storing non-scalar values, like arrays containing numbers, do not get these values converted into strings. Props westonruter.
  • Add a temp_customize_sanitize_js filter so that other plugins can have a chance to run serialization for the output JS-value (used by Widget Customizer); a more robust solution is needed, as noted in the inline comments. Props westonruter.

0.2

  • Eliminate PHP 5.3 requirement by removing namespaces and closures (#22)
  • Fix PHP_CodeSniffer issues according to the WordPress Coding Standards (#17), add to Travis and pre-commit
  • Add jshint to Travis and pre-commit hook (#17)
  • Improve pre-commit hook to optionally scan modified files

0.1.3

Fix handling of settings which contain PHP-serialized values; use customize_controls_enqueue_scripts action.

0.1.2

Correct method for updating customizer, by updating settings not by updating controls.

0.1.1

Eliminate strict standards notice Fix customizer control

0.1.0

First Release