postmark-wordpress icon indicating copy to clipboard operation
postmark-wordpress copied to clipboard

Issue 11 - Multisite compatibility

Open guillaumemolter opened this issue 8 years ago • 17 comments

  • Please merge #14 before
  • Need proper testing but looks all good on my end. Closing #11

guillaumemolter avatar Aug 06 '16 23:08 guillaumemolter

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

BZum1 avatar Jan 20 '17 21:01 BZum1

@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.

guillaumemolter avatar Jan 21 '17 15:01 guillaumemolter

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.

atheken avatar Jan 21 '17 16:01 atheken

@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.

BZum1 avatar Jan 22 '17 14:01 BZum1

Thanks Ben. Based on how things are going, I will probably get to this on Wednesday. I will ping you if I have questions.

//Andrew

On Sun, Jan 22, 2017 at 9:23 AM, Ben [email protected] wrote:

@atheken https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wildbit/postmark-wordpress/pull/15#issuecomment-274333814, or mute the thread https://github.com/notifications/unsubscribe-auth/AACKAWbDfNwFJPz5z6k8Y78eb3mDnF44ks5rU2ZsgaJpZM4JeYqq .

atheken avatar Jan 23 '17 20:01 atheken

@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)

atheken avatar Jan 25 '17 21:01 atheken

@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?

BZum1 avatar Jan 25 '17 22:01 BZum1

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 avatar Jan 25 '17 22:01 guillaumemolter

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. )

guillaumemolter avatar Jan 25 '17 22:01 guillaumemolter

@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.

BZum1 avatar Jan 26 '17 01:01 BZum1

Thanks folks. I appreciate the great detail on this. I'll need a little time to digest and post some thoughts.

I'm fitting this in between other responsibilities, but will keep chipping away at it.

//Andrew

On Jan 25, 2017, at 8:52 PM, Ben [email protected] wrote:

@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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

atheken avatar Jan 26 '17 02:01 atheken

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.

atheken avatar Jan 27 '17 15:01 atheken

@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.)

andrewhaines avatar Jan 27 '17 15:01 andrewhaines

@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.

guillaumemolter avatar Jan 27 '17 15:01 guillaumemolter

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

anthonysexton avatar Oct 04 '20 01:10 anthonysexton

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

trijammer avatar Jul 03 '23 05:07 trijammer

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.

pgraham3 avatar Jul 17 '23 18:07 pgraham3