stuttter / wp-multi-network Goto Github PK
View Code? Open in Web Editor NEWA network management interface for global multisite administrators
Home Page: https://wordpress.org/plugins/wp-multi-network/
License: GNU General Public License v2.0
A network management interface for global multisite administrators
Home Page: https://wordpress.org/plugins/wp-multi-network/
License: GNU General Public License v2.0
At some point, the Networks list-table became broken in a mobile responsive view. I know this, because I just tried using it on my iPhone, and it's very terrible.
Being able to have a network of multisites that users are only able to log into the sites they're assigned to would be advantageous.
The action hook add_network
only receives the new network ID as argument. It would be helpful to have it get passed the arguments that were used to create it as well. This way a callback function can easily detect things like which user created the network or similar.
This will require #1 to be fixed first.
We should have the following CRUD functions for site options:
get_network_option( $network_id, $key, $default = false )
add_network_option( $network_id, $key, $value )
update_network_option( $network_id, $key, $value )
delete_network_option( $network_id, $key, $value )
It would be useful to allow short-circuit of the user_has_networks()
function, for example through an additional filter.
I regularly specify my super admins (global vs per network) through the WordPress $super_admins
variable (I configure the entire network through custom constants in wp-config.php
, and I'd like these constants to determine who is super admin in a network and who isn't). Of course I could use the existing networks_user_is_network_admin
filter to address this, but the function would then still make a redundant database request.
Sometimes &$this
is used which seems to be unnecessary as far as I can tell.
My only resource explaining this is http://tomjn.com/2014/01/08/this/
Add the ability in the UI to purposely "orphan" or "disconnect" a site from a network.
This would functionally make the site_id
column 0 for that site.
As a user I would like some type of clear example/demo for using this plugin. So far I am failing to get the proper functionality out of it. I try to create a new network and it just doesn't work (404s, page breaking).
Users in the support page have also posted similar issues but there was never a response.
https://wordpress.org/support/topic/wp-multi-network-multisite
https://wordpress.org/support/topic/plugin-wp-multi-network-404-for-child-pages
Selecting multiple networks and using the bulk option Delete
does not work
switch_to_network
(or more accurately, restore_current_network
) messes up the network objects returned from get_networks
, as objects are passed by reference, and these are stored in the global $sites
If there are large numbers of sites on either side of the equation when assigning sites to different networks, it's very difficult to find and identify specific sites.
Possibly adding the ability to search / filter the multiple select fields would help mitigate the difficult dealing with large volumes.
See https://core.trac.wordpress.org/ticket/29415
I have a patch for this already, will PR in coming days.
We currently use this plugin on a wordpress 4.5.3
using the version 1.7.0
.
This version was deleted in https://wordpress.org/plugins/wp-multi-network/developers/ so now we are forced to update to 1.8.1
which reqiuires wordpress 4.6
but we cannot update yet to 4.6
. Could you please restore the 1.7.0
version in wordpress or add this plugin to the official main packagist?
When network switching was introduced, an incorrect action name was pushed.
As described by several users saving changes on the Network Edit Page results in all subsites orphaned which are not assigned to the currently edited network.
WordPress › Support » When EDIT a network, its subsites become orphaned?
WordPress › Support » Saving a network removes sites from other networks
WordPress › Support » Network.zero as root domain in dashboard
WordPress › Support » Network Edit Screen fails with WP 4.4.1
Comment on issue #63 "Failling sites on WP 4.4"
The reason for this is located at the end of function reassign_sites_handler() in file includes/classes/class-wp-ms-networks-admin.php. All subsites still listet in the left select box (name="from[]") are "orphaned out" when the update is executed.
At least it is logically not possible in that situation to distinguish which subsites in the "from" list should be orphaned and which should remain assigned to their original network.
A quick solution might be to list only orphaned subsites in the "from" list. Moving a subsite would result in two steps then. The first step is to remove subsites from it's current network and click update to get them orphaned. In the second step the edit page of the new network is called and the previously orphaned subsites can be reassigned.
This plugin is awesome, but I can seem to get the single sign on experience working.
I've added and updated the Cookie constants to my config file, but I'm still prompted for a username and password at each network, and WordPress is saying cookies are blocked or not supported, but they definitely are.
Any reason plugin cannot be top-level instead of living in /src? It makes it much more difficult to use the git version as a WordPress plugin.
It's pretty useful to be able to fetch the main network. There's a non-trivial loading process currently stuck in is_main_network
that can be used for a more generic function.
PR incoming soon.
Right now we use manage_options
for most cap checks, which is both incorrect and lame.
We should be using:
manage_networks
list_networks
create_networks
These better match what's currently checked for sites & users.
Hi, when i put the single sign-on snippet with my primary domain I've got a redirect loop when i go to a another network
// Cookies
define( 'COOKIEHASH', md5( 'yourdomain.com' ) );
define( 'COOKIE_DOMAIN', 'yourdomain.com' );
define( 'ADMIN_COOKIE_PATH', '/' );
define( 'COOKIEPATH', '/' );
define( 'SITECOOKIEPATH', '/' );
define( 'TEST_COOKIE', 'thing_test_cookie' );
define( 'AUTH_COOKIE', 'thing_' . COOKIEHASH );
define( 'USER_COOKIE', 'thing_user_' . COOKIEHASH );
define( 'PASS_COOKIE', 'thing_pass_' . COOKIEHASH );
define( 'SECURE_AUTH_COOKIE', 'thing_sec_' . COOKIEHASH );
define( 'LOGGED_IN_COOKIE', 'thing_logged_in' . COOKIEHASH );
[25-Jan-2016 19:17:11 UTC] PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_MS_Networks_List_Table::get_columns() should not be called statically in /srv/www/dynamics/htdocs/wp-includes/plugin.php on line 213
i have a main multi network site:
http://example.com
and sub network sites
http://example.com/network1
http://example.com/network2
i then create a subsite on network2
http://example.com/network2/site1
when going to this subsite the page is not being rendered properly. In addition if i try to navigate the the admin panel of that site http://example.com/network2/site1/wp-admin I get the error that the site redirected to many times.
any help would be greatly appreciated.
If you call switch_to_network
twice, the $old_network_details
variable is set twice. Rather than using the switch stack, restore_current_network
uses this, so it will be unable to ever switch back. :(
I think it should be possible to remove admin hooks in case someone wants to display the menus for networks somewhere else. Theoretically one could remove the menus afterwards, but that's rather a workaround.
Currently the hooks cannot be removed because the object of WP_MS_Networks_Admin
cannot be retrieved in any way.
Multi-site with subdirectories, not subdomains as blog. Creating networks works fine. However, when assigning blogs to sub-networks, the blogs are not found.
Setup:
domain.com/network1/blog1 - 404 oops
domain.com/network1/blog2 - 404 oops
domain.com/network2/blog1 - 404 oops
domain.com/network2/blog2 - 404 oops
etc.
Changing "path" in wp_blogs, and "site_url", "home" in wp_*_options by removing the / displays the "frontpage" of the blog
domain.com/network1blog1 - Displays frontpage, but does not work when clicking on posts/pages
domain.com/network1blog2 - same as above
domain.com/network2blog1 - same as above
domain.com/network2blog2 - same as above
Standard Multi-site .htaccess: http://paste.debian.net/plain/152338
Since these were introduced to WordPress core in 4.3, we can now safely remove our variants and bump the supported version to the latest.
I know the search for WP_List_Table is bad but this one is broken.
Following issues:
*
(all networks are correctly displayed), result in No networks found.We need unit tests. Working on it. :)
WP Multi Network causes fatal errors from duplicate function names, introduces in WordPress 4.4.
We should wrap them in function_exists()
checks for now, and ensure core function parameters match ours.
Does anyone see a way to create an admin area one level above wp-admin/network
? And this in a "(semi-)native" way?
The query in user_has_networks()
can be simplified by using LIKE
, so that we only get back the network IDs we actually want. This way we don't need to iterate through the results afterwards.
Networks should control their own destiny. While any URL combination is certainly possible, each network would benefit from having a way to dictate down what the appropriate pathing is to load sites & networks quickly.
On a multi network installation when using the "Assign Sites" screen to move sites from one network to another, there isn't enough information displayed to uniquely identify similarly named sites.
It might be useful to show include the site ID, or sub-domain.
Hi,
I've update my copy of the WP repo version with your newest additions here on github,
when creating a 2nd network and going to it's url, it goes into an infinite redirect loop...
Any suggestions? thank you
This bit me just now.
IMO, add_network
should take a mandatory param with the user ID, ala wpmu_create_blog
.
(There's a PR inbound).
@jeremyfelt made a great synopsis of what happened in the WP Multisite Slack channel, I'll copy it here verbatim for ease.
@richardtape has found a nice situation with `WP_Network` and WPMN's use of one of the false promises we added to the object, `WP_Network::get_by_path()`.
`WP_Network::get_by_path()` was brought in from `get_network_by_path()`, which is most useful as a bootstrap function where it finds the closest matching network to a given domain/path. It explodes the domain string on `.` and then checks each level in the query. When used as a check to see if a network exists, the answer is not dependable.
In WPMN trunk, `get_network_by_path()` is now used to check for the existence of a network when it is added. This will work when the network is completely different - `abc.dev` vs `xyz.com`, but not when the network is a subdomain - `abc.xyz.com` vs `xyz.com`.
I think it may make sense to remove `get_by_path` from `WP_Network` in 4.4 and leave `get_network_by_path()` on its own as the bootstrap function it is. In 4.5, we can look at some proper lookup methods for finding networks with an exact match.
@jjj - thoughts?
For reference: e1f7c68#diff-e4e3c9edcb69fabfa2875311f180391dR284 is the change in WPMN. $network
will never be empty given the conditions above when using get_network_by_path()
because it will return at least the root network and therefore it always appears as if the requested new network exists
And, to add; reverting to
$sql = "SELECT * FROM {$wpdb->site} WHERE domain = %s AND path = %s LIMIT 1";
$query = $wpdb->prepare( $sql, $r['domain'], $r['path'] );
$network = $wpdb->get_row( $query );
‘fixes’ the issue in `add_network()
After upgrading to wp4.4, and upgrading this plugin to 1.7.0, I am not able to assign sites to more than one network. When trying to assign sites to another network all other networks loses their sites. also, now i get network.zero domains for sites i try to visit. What's happening?
Ok this is what I did:
Here are my MS settings in wp-config:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST']);
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
I'd like to move this plugin into the Stuttter organization, but want to make sure there are no objections from other contributors, @rmccue specifically who's been active recently.
If I have a site on network 2 with the subdomain foobar.network2.example.com
, and try to move across a site from the main network with the same subdomain (foobar.example.com
), WPMN happily does this without complaining.
This causes two sites in the same network to both have the same subdomain, and hence same full URL. 👎
WPMN should check for this when moving, and a) fail to move it at all, and b) offer to move and rename (after running through the uniqueness process).
I think it would be handy to add a "View" link in the All Networks UI, would make auditing older Networks easier, especially ones that only have 1 in the sites column. Such as adding view_network to manage_network_action_links would suffice.
In most cases esc_html_e()
is overkill. The language files should be considered safe code, right?
So if there is not (s)printf() injecting some dynamic string _e()
is sufficent and secure.
With WP Multi Network all plugins on each network are independent of each other and can be network activated, activated and updated for one network and not the other. That's not the case with WP Multi Network being activated on one network. Its network activated on all networks, even if I only activate it on the root site networkone.com/wp-admin/plugins
. It can be network deactivated on the second network, networktwo.com/wp-admin/network/plugins/
but still activated (not network activated) on networkone.com
and everything still works (that's good), that's what I want to happen.
Is this a bug or is it the intended action to have WP Multi Network network activated across all networks?
In the "My Networks" page wp-admin/index.php?page=my-networks
, the user only sees the networks where he's super admin.
In the "All Networks" page wp-admin/network/admin.php?page=networks
, the user sees all the networks.
This behavior has to be corrected, because without that, a super admin user can change everything in all networks, even if he's not a super admin of a network.
Similar to #77, if someone moves the networks screen somewhere else, they might need to change the URL as well. Therefore I'm proposing to introduce a filter to the WP_MS_Networks_Admin::admin_url()
method in case someone needs to override it.
Moving a site from the main network across to a different network doesn't appear to update the siteurl
or home
, leading it to still think it's available at abc.example.com
instead of abc.othernetwork.example.com
.
if
define( 'ENABLE_NETWORK_ZERO', true );
define( 'RESCUE_ORPHANED_BLOGS', true );
then
PHP Error Count Location Call Stack Component
Warning Creating default object from empty value
1
/srv/www/wp-content/plugins/wp-multi-network/includes/functions-wp-ms-networks.php:541
move_site()
delete_network()
WPMN_Admin->delete_network_page()
WPMN_Admin->networks_page()
do_action('toplevel_page_networks')
Core
This is pretty late to register functions like switch_to_network
(e.g.). Can we move it earlier? :)
I found a number of broken links in admin list view.
The "Network admin" link doesn't use the network_admin_url function. If you are filtering network_site_url which I am for domain mapping reasons, you get the unfiltered url.
Visit, Dashboard links link to the wrong site url. It links to a different blog in the network. At a guess, I would guess this happened because the links link to the blog in the network that has the lowest blog id. This however is not the "primary" site on the network. This is because the blog was transferred into the network from another earlier network.
Both of these views should work how the sites list table works and use the switch_to_network() and restore_current_network() function calls while loop around network. In that context you can just call network_admin_url and network_site_url functions.
Related: #11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.