I use Michael Simpson’s excellent template for writing WordPress plugins. At present it does not explicitly support multisite plugins. This is a cross-post of my investigation that I posted on his site.
Thank you Michael,
I have done a little reading
- “Professional WordPress” by Brad Williams et. al.
These are my early thoughts and will contain errors and omissions,
Multisite (hereafter “Network”) changes some things relevant to your template
- Plugins may be activated once for all present and _future_ blogs (Network activation) or activated for individual blogs
- Plugin data can be stored in tables at the Network level or in tables as individual blogs
- Network support additional features including
- superusers who manage a Network
- Network options
- Plugin authors must decide what are plugin options that are typically available too blog administrators in a back-end administrator menu and what are network options that are only available to superusers in the network administrator menu.
- Plugin code is called in the context of a blog with a $blog_id. This is important for reading and persisting data. For example, post data would be recalled from the current blog.
The implications for your template can be viewed through the lens of the template files,
- Comments to indicate that the author may set “Network: true” if the plugin is multisite compatible
- Must optionally check for deployment within a Network and have a different behaviour
- Lots of changes, needs to support Network Activation and/or activation of a single site within a Network
- Must support Network Options
At the moment it is true to say
- “this template does not support multisite plugins”
because there is not template code to support operation in a network.
I am not sure it is true to say
- “this template is not multisite compatible”
The later sentence implies that a plugin written using this template must break. I think that this is not true. I have tested “Network activation” of plugin in a multisite network and it fails gracefully. That is to say that it simply returns with no message. When the plugin is activated on the site it works fine.
If upon review and further testing you agree with my conclusion you may wish to change your communication to,
A multisite network offers several capabilities to a plugin author such as network activation, network data storage and network options, that are not supported by this template. However a plugin written using this template should work correctly when activated within an individual site on the network.
Did you then make the changes to make the template compatible with multisite?
If so, do you have a repo on github or can you send me the code from which I can see how you solved it?
It seems that Simpson is no longer interested in the project …
Dr James Bayley said:
Thank you for your enquiry – I did not solve this problem.
I actually stopped using multisite because it was the wrong solution for me. The key point is that users authenticate with the multisite network itself – not the individual blog. That is great if you have an open community like wordpress.com but bad if you need strong security between sites – in my case my different clients.
The promise of multisite is easier code maintenance but in practice, for most use cases, you are better off building many individual sites. For small numbers this is easy to manage manually, for larger numbers there are many deployment and management tools available. Individual sites offer the flexibility to customise them for clients that multisite might not.