Forms are just plain hard to execute well. It's exactly the kind of thing that…
Setting up a demo for your WordPress plugin or theme used to be hard. Ninja Demo makes it easy.
What’s It Do?
Ninja Demo allows you to create a simple Sandbox environment so you can give users access to a demo site for them to play around with your product. Each user gets their own personal sandbox, and none of the changes they make on the site stay permanent. You control exactly what admin pages users have access to, and which user they should be logged in as. Ninja Demo uses the power of WordPress multisite to create these one-off sandboxes, so there really is no limit to how many can be created. The plugin also gives you access to a few shortcodes, functions, filters and hooks to place the login form for the plugin and extend its functionality.
How’s It Work?
Setting up Ninja Demo is a bit different than most plugins. The first thing you have to do is make sure that you have WordPress Multisite installed. You can find instructions for this in the codex. After you have a multisite setup, visit your main site, and set up dummy users you want demo visitors to use. For now, you can just set up one with administrator privileges. The last step is to go back to the super admin dashboard for your entire network, upload the plugin file, and click the “Network Activate” button to make it available to every site in WordPress multisite. Then, go ahead and visit the main site to get started with the plugin.
The first thing you’ll want to is actually set up your site to be a proper demo. If it’s a plugin you want to demo, then make sure the plugin is installed and configured with default options. If it’s a theme, activate the theme and make any stylistic changes necessary. In both cases, you’ll probably want to add some dummy content so that users have a few examples for playing around with.
In the admin sidebar, you will see a new menu option in the sidebar labeled “Ninja Demo.” Click on this to configure the plugin. At the top, you will see a checked checkbox labeled “Offline Mode.” Offline Mode means that users visiting the site will not be able to log in to demo mode. Check this off to make your demo go live. There’s also a checkbox below this labeled “Prevent Future Sandboxes.” This is useful if you want to keep all of the data created by users that have already visited your demo but want to turn it offline to future users.
Below this is a dropbox labeled “Auto-login Users As.” From the drop-down menu, select the user that you created for demo purposes.
The “Restriction Settings” is where the bulk of the plugin’s functionality is. You will see a list of every page in your admin panel, including individual plugin pages, and a checkbox next to each. It works by allowing you to whitelist certain admin pages. This means that users will only be able to visit the exact admin pages that you specify. This includes the ability to just show users individual submenu pages without showing them the parent pages. Select all of the pages that demo users absolutely need to see, and then click the “Save” button.
The next step is to actually insert the login form for users. This places a form on your site which asks users to answer a very simple math question, like 10 + 7. If they answer the question correctly then they are logged in. This is a good way of preventing spambots from entering the demo area.
To add this form, go to any post, page, or widget (preferably something on the homepage), and enter in the shortcode [try_demo]. And that’s it. Just like that, you’ll have a fully functioning WordPress demo site up and running that any user can take for a spin. Users will be able to access the admin, add new content, and play around with your product. And when they are finished, they’re changes are completely removed, and do not affect anyone else.
There are also a couple of additional shortcodes that may help you out. If you place content between a [is_sandbox][/is_sandbox] shortcode, then that content will only be shown to users after they have logged into the sandbox. The opposite is true for [is_not_sandbox][/is_not_sandbox], content will only be shown to logged out users. And finally, [is_sandbox_expired][/is_sandbox_expired] can be used to show special content to users whose session has expired.
There are also several hooks, filters, and functions you can use to extend the plugin’s functionality. For instance, the Ninja_Demo()->is_sandbox() can be used to pass content or functionality to users that have logged in to a sandbox. The nd_allowed_cpts filter can be used to whitelist only certain custom post types to sandbox users, to further restrict access. If you’d like to know more about the plugin’s developer API, you can visit the plugin documentation.
Costs, Caveats, Etc.
Ninja Demo is a premium plugin, and licenses can be purchased for single sites, or for unlimited installations. A license comes with direct support and updates for a year, and there is plenty more that the team is hoping to add. If you are having issues with the plugin, you can also try the documentation or check out the setup video the team put out.