Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 11 - Multisite compatibility #15

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

guillaumemolter
Copy link
Contributor

@BZum1
Copy link

BZum1 commented Jan 20, 2017

@guillaumemolter the conflict here seems easily resolved. Is there anything else preventing merge? Does it require more testing?

@guillaumemolter
Copy link
Contributor Author

guillaumemolter commented Jan 21, 2017

@BZum1 no...opened #14 and #15 a while ago but clearly no interest from Wildbit to receive help or really supporting the WordPress plugin. In any case I'm not going to waste any more time on this.

@atheken
Copy link
Contributor

atheken commented Jan 21, 2017

Hey folks,

We do want to add multi-site to the plugin, and I do appreciate the pull request. The issue is that I need to dedicate time to reviewing the diff, and making sure I understand how multi-site works so that we can properly support it when we get support cases on it.

It's not excusable that I haven't responded to this PR in a more timely manner, but I'll spend some time within the next week to review this and provide feedback or get it merged.

@BZum1
Copy link

BZum1 commented Jan 22, 2017

@atheken, Thanks for your prompt response. I'd be glad to assist with further testing on single and multi-site installs if that's useful.

@atheken
Copy link
Contributor

atheken commented Jan 23, 2017 via email

@atheken
Copy link
Contributor

atheken commented Jan 25, 2017

@guillaumemolter / @BZum1 Hey folks, so I started to look in to merging this, and I configured a network using these instructions: https://codex.wordpress.org/Multisite_Network_Administration

Is there an example of where I should see the postmark plugin settings UI, or am I missing something? (Testing with Wordpress 4.7.1)

@BZum1
Copy link

BZum1 commented Jan 25, 2017

@atheken In a multisite environment the Postmark settings should appear on the main "Network Admin" dashboard under Settings (http://siteurl.com/wp-admin/network), and not on the individual site's Settings menu. Is it not showing there?

@guillaumemolter
Copy link
Contributor Author

guillaumemolter commented Jan 25, 2017

Hi Andrew,

Not sure how much you know about WP Multisite so forgive me if I'm stating the obvious.

When you upload a plugin on a multisite network you have two options: either to network activate the plugin (meaning the plugin will be activated on all website of the network whether or not you want it) or you can activate the plugin on individual websites (which works exactly like on a single site installation of WordPress).

Traditionally (single site installation) setting pages (called option pages in the WP lingo) are located under the Settings section of the WordPress admin ( /wp-admin/options.php?yourpluginparams).

On network activated plugins the page is moved to the network admin ( /wp-admin/network/settings.php?page=yourplugin ) in a dedicated page. Some plugins do both, they have a global settings page in the network admin and a local admin page in each website for more site specific settings or to allow to override locally. I think In your case you should focus on the first option.

WordPress Multisite, since it's not as popular as single site, has always been behind in terms of features and while I know it's on their roadmap currently doesn't support the Settings API that is tradionnaly used to create option page for plugins, in other words you will need to write some specific code for the network option page. Here is an example: https://vedovini.net/2015/10/using-the-wordpress-settings-api-with-network-admin-pages/

A more visual example:
screen shot 2017-01-25 at 5 15 05 pm
This is: https://wordpress.org/plugins/google-apps-login/

@guillaumemolter
Copy link
Contributor Author

I should also add 2 more details:

  1. Network settings and network activated plugins settings are using get_site_option and update_site_option (instead of get_option update_option) to save settings at the network level instead of the blog level.
  2. This PR does not move the option screen to the network admin (it simply save and retrieve settings at the network level as explained in 1. )

@BZum1
Copy link

BZum1 commented Jan 26, 2017

@atheken In my testing, it appears that this PR removes the Postmark option screen from each individual site's Settings menu, but also, as @guillaumemolter noted, does not add it to the network admin Settings menu.

Changing the new network_admin_menu function to the following actually adds the option page to the network admin Settings area:

function network_admin_menu() {
     add_submenu_page( 'settings.php', 'Postmark', 'Postmark', 'manage_network_options', 'pm_admin', array( $this, 'settings_html' ) );
   }

Apparently the use of the "add_options_page" wrapper function doesn't work here. In testing, values added using this page are then saved at the network level.

Alternately, if we want to keep the Postmark options page at the level of each individual site, it seems like we'd want to continue to use the admin_menu() function instead of the network_admin_menu() function.

@atheken
Copy link
Contributor

atheken commented Jan 26, 2017 via email

@atheken
Copy link
Contributor

atheken commented Jan 27, 2017

Just an update here. I will probably have a chance to make more progress on this next Wednesday.

I'm not really sure of what customers would prefer here:

  1. One Postmark config for all sites, or;
  2. One Postmark config for each site.

Hypothetically, it seems like the preference would be to be able to set per-site settings for "From" address, and (maybe), Server-Token. I'm thinking of a media firm that might be managing dozens of uniquely branded sites for different customers. That seems like the more common "server-per-site" configuration.

What I'm also not sure of, is whether this would be something that a Network Admin would delegate to site admins, or whether they would manage this in the Network Admin area?

Perhaps what we need is a "master" UI in NetworkAdmin that allows blanket application of the Server settings, with the option of delegating who can see/use the server-level settings page for the plugin.

Just "spit-balling" here, I definitely want to make this awesome, but I'm not a Wordpress guru.

@andrewhaines
Copy link
Contributor

@atheken I think your last suggestion re: a master UI with optional permissions is spot on. (I work w/ @BZum1 on building and managing WordPress sites.)

@guillaumemolter
Copy link
Contributor Author

@atheken super ideally in my "dream" postmark plugin:

  • Always have a network level settings page.
  • In addition to the "standard" fields the network settings page would have a checkbox "Allow individual sites to override network settings" which when checked would display a second screen at the site level with values that can be overridden ( I would argue all a them and when left blank use the network settings).
  • The network admin page should be accessible to users with the "manage_network_options" capability and the local site one to users with the "manage_options" capability. You could eventually have a drop-down in the network setting page to change the capability for the site option page capability but I think this is not necessary. As a compromise you could simply add a documented filter to the plugin to allow users to programmatically change the capability. (In general I strongly recommend you add a lot of filters/hooks to your plugin to allow customers to more easily and properly override the default behaviors).

This makes things slightly more complex but would provide your customers with maximum flexibility and is kind of the standard UX for "network enabled" plugins.

@anthonysexton
Copy link

Any chance this will be picked up again at some point?

@trijammer
Copy link

Any appetite to continue work on this? It'd be very handy...

@pgraham3
Copy link
Contributor

Hey @trijammer - There are no current plans to work on this at the moment but that is due to lack of bandwidth rather than a decision being made that we don't want to add multisite support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants