When you create template sites, you will usually need to create a plugin to handle one-time tasks for a new site.
This plugin code will run once on the new customer site and will handle things such as:
- Changing screen terminology
- Search and replace domains
- Search and replace text (eg: to set the user’s name, company name, address etc. in various locations where placeholders have been used.)
- Install brand logos / colors
- and potentially much much more.
The key is to make sure that it runs once and only once.
To do this, the plugin init code will check to see if a particular WP Option is set to match the current domain. If it is, it exits (and might even disable the plugin so the code will never run again until the plugin is re-enabled).
If the option is not found or has a value that does not match the current domain, it runs all the routines and then sets the WP Option value to the current domain to indicate that it has completed.
If there is no other functionality needed for later it might then also deactivate itself to prevent anyone else from accidentally running it.
But self-deactivation is rare – because you can (and eventually will) use this plugin to provide all kinds of highly customized experiences tailored to your audience.
While you might start off with it doing the simplest things, it will eventually become the thing the glues your entire SaaS together to provide a cohesive end-user experience.
Request a Demo
Want to see OpenSaas.io in action? Request a demo - just pick a time from our calendar.