Coder Social home page Coder Social logo

bueltge / wordpress-multisite-enhancements Goto Github PK

View Code? Open in Web Editor NEW
104.0 9.0 28.0 4.32 MB

Enhance WordPress Multisite for Network Admins with different topics

Home Page: https://wordpress.org/plugins/multisite-enhancements/

License: GNU General Public License v2.0

PHP 83.05% JavaScript 7.59% CSS 0.26% Shell 9.09%
wordpress-multisite wordpress multisite administration

wordpress-multisite-enhancements's Introduction

WordPress Multisite Enhancements

Enhance Multisite for Network Admins with different topics

Description

When you work quite a bit with WordPress Multisites, sometimes you need more information or menu items. This plugin enhances the network area for super admins with useful functions.

  • Adds Blog and User ID in network view more
  • Enables an 'Add New' link under the Plugins menu for Network admins
  • Adds several useful items to the multisite 'Network Admin' admin bar
  • On the network plugins page, shows which site has this plugin active.
  • On the network theme page, shows which blog has the theme active and is a Child theme.
    • If you have more as 4 sites active for an plugin, theme then is the list only available via click for an proper way to not overload the admin interface.
  • Change Admin footer text for Administrators to view currently used RAM, SQL, RAM version fast
  • Adds Favicon from theme folder to the admin area to easily identify the blog, use the favicon.ico file in the theme folder of the active theme in each blog
  • Adds Favicon to each blog on the Admin Bar Item 'My Sites'. If you a like a custom path for each favicon, please see the documentation for this feature.
  • Removes also the 'W' logo and his sub-links in admin bar
  • Adds the status to each site in the admin bar to identify fastly if the site has a noindex status and to see the external url.
  • Add functions to be used in your install
    • The function get_blog_list() is currently deprecated in the WP Core, but currently usable. The plugin checks this and gets an alternative in src/core.php
    • If you will develop with the alternative to this function from my source, then use the method get_blog_list() in class Multisite_Core. My source also use caching with the Transient API. More about the function in src/class-core.php.
    • If you use WordPress version 3.7 and higher, then check the function wp_get_sites(), the new alternative function inside the core to get all sides inside the network. The function accepts a array with arguments, see the description.
    • But if you use WordPress 4.6 and higher then that new alternative ;) - get_sites() - is the current function to get all sites in the network. The helper method of this plugin Multisite_Core::get_blog_list() or the function get_blog_list() have all checks included.
  • Filter theme list to find your target fast. Works on single theme page and also network theme page.
  • Handy ssl identifier to each site in network site view page.

Installation

Composer Package

The plugin is available as Composer package and can be installed via Composer:
composer create-project bueltge/wordpress-multisite-enhancements --no-dev.

The package is on packagist and the package name is bueltge/wordpress-multisite-enhancements.

WordPress backend

Use the installer via back-end. Find via search and install.

Manual mode, (s)FTP

  1. Unpack the download-package.
  2. Upload the files to the /wp-content/plugins/ directory.
  3. Activate the plugin through the Network/Plugins menu in WordPress and click Network Activate.

Screenshots

  1. Blog ID on Sites

Blog ID on Sites

  1. User ID on Users

User ID on Users

  1. Add New link to install new plugin on each blog

Add New link to install new plugin on each blog

  1. Manage Comments with Counter on Admin Bar

Manage Comments with Counter on Admin Bar

  1. On which blog is the plugin active

On which blog is the plugin active

  1. On which blog is the theme active

On which blog is the theme active

  1. New Admin footer text

New Admin footer text

  1. Favicon on Admin bar

Favicon on Admin bar

  1. Filter Themes

Filter Themes

Other Notes

Crafted by Inpsyde · The team is engineering the Web since 2006.

Bugs, technical hints or contribute

Please give me feedback, contribute and file technical bugs on this GitHub Repo, use Issues.

License

Good news, this plugin is free for everyone! Since it's released under the GPL, you can use it free of charge on your personal or commercial blog. But if you enjoy this plugin, you can thank me and leave a small donation for the time I've spent writing and supporting this plugin. And I really don't want to know how many hours of my life this plugin has already eaten ;)

Contact & Feedback

The plugin is designed and developed by me Frank Bültge

Please let me know if you like the plugin or you hate it or whatever ... Please fork it, add an issue for ideas and bugs.

Disclaimer

I'm German and my English might be gruesome here and there. So please be patient with me and let me know of typos or grammatical parts. Thanks

wordpress-multisite-enhancements's People

Contributors

bjorsq avatar bueltge avatar cfoellmann avatar codelingobot avatar danielhuesken avatar derpixler avatar galileopress avatar garyjones avatar hvianna avatar joryhogeveen avatar justthomas avatar noelboss avatar peteredwards avatar zodiac1978 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-multisite-enhancements's Issues

Don't hard-code RAM number format

This line effectively hard-codes the number format for the RAM, which means that it looks odd in other locales (like British English), where we'd use a . as the decimal point, and , as the thousands separator.

Alphabetize sites on which plugins are active

The feature that shows which sites a plugin is active on is very helpful. The list of sites, however, is shown in order of site ID instead of alphabetically by site name.

Would it be possible to alphabetize the list of sites by name?

Child, Parent Theme context

View the context between Parent and Child Theme.
Currently we can see, which theme is active, also on Child themes. But we don't see the context to the parent.

Multisite-Enhancements 1.4.0 problem

We have two multisite WP environments at SMU and both have the Multisite Enhancements plugin installed. However, when doing a routine update from 1.3.8 to 1.4.0 on one of them, the server threw a 500 error. I uninstalled the plugin which brought the site back up, and attempted download and re-install of 1.4.0, but had the same result. I meanwhile still had my copy of 1.3.8 on the other site, and simply copied it over to the site where I had to uninstall 1.4.0, and 1.3.8 is now, once again, working properly in both places. You, however, need to know that 1.4.0 has a bug that causes it to crash. Looking forward to a new version that doesn't have this bug. Are there any other such reports?

Gary Torborg

Disable "WP Logo" + sub-menu for all users (not only super-admin)

Dear Frank,

Thank you for the plug-in, it works like a charm and really makes life of admin easier.

One question: would it be possible or is there a way to disable the "WP Logo" + sub-menu for all users ?

I have the feeling it removes the WP Logo for super-admin only.

Thanks a lot for your help,

Best regards,

Alexandre 8)

Enhance apprevation for RAM values

Enhance the tooltip with more information about the values.

The first value is calculated from the server via memory_get_peak_usage – Returns the peak of memory allocated by PHP – and the value after / is the value, set from your installation, via the constant WP_MEMORY_LIMIT.

https://github.com/bueltge/wordpress-multisite-enhancements/blob/666cbb30549668bd6560d63918df4e88c18db2d1/src/class-change-footer-text.php#L119&L128

via https://wordpress.org/support/topic/ram-95-0-64m-sql-39-phpv-8-0-3version-5-7/#post-14487107

Plugin / theme lists and multiple networks

When a multisite has multiple networks, the list of sites on which a plugin or theme is active only shows one network -- and it might not be the current network because the list is stored in a site transient.

I propose that either of the following changes be made:

  1. show sites from current network where plugin/theme is active, i.e. unique site transient per network
  2. show all sites where plugin/theme is active, regardless of network

Option 1 is pretty painless to implement, because it involves adding the site ID to the site transient name. However, I reckon it's more useful to know all sites where a plugin is active, and if one has several networks, that would require visiting each network's plugin admin page to find that out.

Conversely, on a multisite with several networks each hosting many sites, the list could be so big as to be unmanageable. In that case, option 1 might be preferable to option 2.

I'd be happy to submit a PR for either approach, if you can indicate which option you'd prefer, or perhaps suggest something even better.

Plugin retrieves favicons of sites which do not appear in admin bar

My admin bar only shows 6 websites under the "My Sites" section, but the "Multisite Enhancements" plugin retrieves the paths to the favicons of all >100 sites in my network. This results in >100 single DB queries which retrieve the path to a favicon which never appers in my admin bar.

You could probably save a lot of DB queries by replacing wp_get_sites with get_blogs_of_user in Multisite_Add_Admin_Favicon::set_admin_bar_blog_icon().

Plugin error or not error?

In wp debug mode should this error be displayed, or is it a plugin error?

“Notice: Trying to access array offset on value of type bool in /my-dir/wp-content/plugins/multisite-enhancements/src/class-add-admin-favicon.php on line 213”

PHP Notice: Trying to access array offset on value of type bool in /var/www/html/wp-content/plugins/multisite-enhancements/inc/autoload/class-add-admin-favicon.php on line 219

Hi, getting lots of (in WP Debug logs):
PHP Notice: Trying to access array offset on value of type bool in /var/www/html/wp-content/plugins/multisite-enhancements/inc/autoload/class-add-admin-favicon.php on line 21

WP: 5.4.2
PHP: 7.4.8

Love the plugin, been using it for years. If I get some time I'll try to put a PR together on this.

Tested up to:

You should update the Tested up to: version on wp_org

Remove `Filtering_Plugins` class

No longer necessary, this idea, plugin solution was the start to include this in the core of WP, ready for usage since version 4.6.

'Active in' typo

The columns for the theme and plugin activations are named Active in which should be Active on or I would suggest Usage (de_DE Nutzung)

Subdomain Plugin Activated Status

.. but now the "Active In" Section in the Network Admin Plugin Page is no longer showing if a plugin is active in a subdomain.

Subdir vs. Subdomain.
On Subdomain was not listet the active plugins from subsites.

Transients in Debug mode

The notice Multisite Enhancements: Delete site transients for the plugin usage to help on development, debugging. The constant WP_DEBUG is true. is very irritating.

It does mean: The transients were deleted!?
My alternative:

Multisite Enhancements: [WP_DEBUG = true] Site transients (plugin usage caching) were cleared to help with development, debugging.

Same for themes.

Add a more reliable way to enable/disable features

Hi,

As I was disabling some features in the plugin using your recommended custom plugin mehtod, I realized that this method was really susceptible to break. It actually already wouldn't work if you follow the comments in the example plugin. Because you are using numeric keys to dequeue auto-load files and those files are auto-loaded alphabetically in the array, adding a new files (when adding new features) to the plugin would change the keys and therefor break all customizations.

I think the plugin should move to a more reliable way to do this, here are a few suggestions:

  • Unset elements based on value using something like:
if( false !== ( $key = array_search( $filename, $files ) ) ) {
    unset( $messages[$key] );
}
  • Add a network setting page where user could enable/disable features.
  • Add a dedicated filter in each class constructor allowing us to disable each feature (which could offer more flexibility when multiple features are bundled in one class).

Happy to contribute a patch based on what you think is the best solution.

Please provide more examples

I've seen the documentation but it's not clear enough, it does not have examples for every hook.

Could you improve the documentation?

[Bug]: database error with wpml

Description of the bug

it seems the enhance_network_blog_admin_bar call is also calling something in wpml, even if the site that is throwing the error has wpml not acative

[13-Jun-2024 15:33:35 UTC] WordPress database error Table 'client.client_wp_3_icl_translations' doesn't exist for query SELECT  COUNT(*)
			 FROM client_wp_3_comments 	JOIN client_wp_3_icl_translations icltr2
							ON icltr2.element_id = client_wp_3_comments.comment_post_ID
							JOIN client_wp_3_posts ON  client_wp_3_posts.ID = icltr2.element_id
							AND CONCAT('post_', client_wp_3_posts.post_type) = icltr2.element_type
						LEFT JOIN client_wp_3_icl_translations icltr_comment
							ON icltr_comment.element_id = client_wp_3_comments.comment_ID
								AND icltr_comment.element_type = 'comment'
					
			 WHERE ( comment_approved = 'post-trashed' )  AND icltr2.language_code = 'de'
															AND (icltr_comment.language_code IS NULL
																	OR icltr_comment.language_code = icltr2.language_code
																) 
			 
			 
			  made by require_once('wp-admin/admin-header.php'), do_action('in_admin_header'), WP_Hook->do_action, WP_Hook->apply_filters, wp_admin_bar_render, do_action_ref_array('admin_bar_menu'), WP_Hook->do_action, WP_Hook->apply_filters, Multisite_Enhancements\Admin_Bar_Tweaks->enhance_network_blog_admin_bar, wp_count_comments, get_comment_count, get_comments, WP_Comment_Query->query, WP_Comment_Query->get_comments, WP_Comment_Query->get_comment_ids

Reproduction instructions

calling admin (area) of blog id 1 (with wpml active), produces the error for blog id 3

Expected behavior

no db error message

Environment info

  • latest wpml plugin
  • latest multisite enhancement (1.7.0)

Relevant log output

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

PHP Notice: Undefined index: Network

PHP Notice: Undefined index: Network in wp-content/plugins/multisite-enhancements/inc/autoload/class-add-plugin-list.php:235

- WP_List_Table->display()wp-admin/plugins.php:565
- WP_List_Table->display_rows_or_placeholder()wp-admin/includes/class-wp-list-table.php:1097
- WP_Plugins_List_Table->display_rows()wp-admin/includes/class-wp-list-table.php:1165
- WP_Plugins_List_Table->single_row()wp-admin/includes/class-wp-plugins-list-table.php:534
- do_action('manage_plugins_custom_column')wp-admin/includes/class-wp-plugins-list-table.php:824
- Multisite_Add_Plugin_List->manage_plugins_custom_column()wp-includes/class-wp-hook.php:286

Latest releases of WP and plugin.

[Bug]: Use of `continue` inside of `switch_to_blog()` corrupts blog loop

Description of the bug

In 9063da7 you modified the admin-bar routine so that the current blog is skipped when no comment node can be found. However, because this happens inside a switch_to_blog() loop, the next call to switch_to_blog() causes the next blog_id to be added to the top of the "switched" stack. Then, when restore_current_blog() is finally called, the incorrect blog is return. This results in data corruption when the rest of the page is rendered, since WP thinks we're on the wrong blog.

Reproduction instructions

  1. On Multisite, visit a secondary site while logged in as a user who is a member of a number of sites, at least one of which will not have the $comment_node
  2. You'll see data corruption on the rest of the page

Expected behavior

The correct data will load.

Environment info

No response

Relevant log output

No response

Additional context

The fix is to add a restore_current_blog() call just before continue:

				$comment_node = $wp_admin_bar->get_node( $menu_id );
				if ( ! $comment_node ) {
					restore_current_blog();
					continue;
				}

I can send a PR if it's preferred.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Plugins aren't loaded on the Network, Sites page

Description of the bug

In WP 6.1, it appears that the Network, Sites page (network/sites.php) does not load any plugins (even if plugins are network enabled), so the class that adds the blog ID to the Network, Sites list does not get executed.

I have verified this by installing and activating the add-blog-id plugin code from here, and the ID column is not shown. And if you put a 'die' statement in the plugin code, the 'die' never happens.

The code for the class will work if you put it in the active theme's functions.php file, so it's not a code problem. It appears to be a 'core' problem that the Network, Sites page does not load any plugins.

I don't have enough reputation to add an issue in WP Core. But would like to figure out how to use the add-blog-id plugin code you have provided.

Reproduction instructions

  1. Copy the 'add-blog-id' plugin code to the network's plugin folder.
  2. Network Activate the plugin
  3. Go to Networks, SItes page to show All Sites list
  4. Note that the blog id column is not shown on that page.

Expected behavior

The Network, Sites list page should show the Blog ID column.

Environment info

Using WP 6.1, multisite installation

Relevant log output

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Admin bar features do not scale very well

We use this plugin in a big multisite with 50+ sites. Some users are registered to all 50+ sites.

Two features of this plugin are now very time consuming:
enhance_network_blog_admin_bar()
set_admin_bar_blog_icon()

The first adds the "Manage Comments"-menu item to the admin bar. Therefore it needs to run through all sites (switch_to_blog()) to see if the user is able to manage comments in order to print the comments.

The 2nd prints the favicon for a site (if given) in the admin bar. Therefore it needs to run through all sites and check for a favicon.

For our case, we do not need those features, so it would be good, if those features could be optional.

Alternatively (or additional), maybe there could be a better strategy using switch_to_blog(), so the calls could be reduced. I am not quite sure, how caching could be applied here given the comments count needs to be quite up to date.

Single sign on to subsites

Hey Frank

What about adding a single sign on to the full multisite. So a Super Admin will not need to sign in to every sub site?

[Feature Request]: Make it easier to spot unsafe sites (without https)

Is your feature request related to a problem?

It is not easy to spot unsafe sites (without ssl).

The visual difference between the dashicon unlock/lock is minimal and not easy to spot.

Describe the desired solution

I would recommend using the yes/no dashicons, maybe with red/green color.

Describe the alternatives that you have considered

Additionally, the column could be set up to be sorted, so it would much easier to find unsafe sites.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Translation problem

The n-strings "Active on %s site" / "Active on %s sites" are used both for plugins and themes. However, the word active (single or plural), may not be translated to the same word when meaning plugins as when meaning themes (different gender association).

So, suggest split into to two separate n-pair of strings, with contexts themes and plugins.

Settings page

Currently load the plugin all classes, no options.
Maybe we add a settings page inside the network view to select, which class will be loaded.

Tapping into is_theme_active_on_blogs()

This plugin is very useful for a site of a few hundred sites, most of them student portfolios, thanks so much.

I'm trying to write a small plugin that adds a network dashboard plugin that just gives the count of sites using 3 specific themes, and likely my own lack of oop skills- how can I use the is_theme_active_on_blogs function outside of your plugin? I am trying to loop through them:

$active_on = Multisite_Add_Theme_List::is_theme_active_on_blogs( $theme_key );

but getting fatal errors of

Using $this when not in object context

List of sites per theme/plugin can get long

I think the list of sites added to the plugins and themes site can get quiet long.
Is that a problem for anyone? Maybe hiding the list and opening only onClick or in a modal would be good for big sites

admin failing html validation

First error is in inc/autoload/class-admin-bar-tweaks.php on line 95. The span with id=”ab-awaiting-mod” is duplicated for each site in the My Sites menu, resulting in Duplicate ID errors when validating the HTML. Suggest ab-awaiting-mod be appended with the $blog->userblog_id so that it creates a unique id for the span element, such as ad-awaiting-mod-3 when $blog->userblog_id is 3.

Second error is in inc/autoload/class-change-footer-text.php on line 120. The closing is missing and needs to be added to the end of the string being created on this line.

via https://wordpress.org/support/topic/minor-errors-result-in-admin-failing-html-validation/

Gallery block error

Hello,

I tested this plugin on a empty WordPress. It is the only plugin installed and activated.
Everything works except the Gut gallery block

For the test I used the default theme: "Twenty Twenty".

Thank you for your help

2021-02-05 15 14 55

WordPress version : 5.6.1
PHP version : 7.3

Admin bar submenu's don't work correctly anymore.

The solution added in the latest version to make the sites adminbar menu scrollable isn't valid.
This change has multiple issues:

  • Overwrites CSS for ALL submenu's in the admin bar
  • Multiple submenu's (3rd level) cannot be visible
  • Fixed widths for submenu's instead of the slick auto-widths approach of WP core itself.
  • Menu's on the right side are totally messed up.

A similar solution has been rejected by WP core due to it's limitations. An absolute positioned element (2nd submenu) cannot be visible outsite of a scrollable container.
The solution isn't to enable overflow scrolling on this element but to have some sort of Javascript scrolling which modifies the position of the whole sites submenu.

PHP Notice: Undefined index: plugin_status

PHP Notice:
Undefined index: plugin_status in /fullpath/wp-content/plugins/multisite-enhancements/inc/autoload/class-add-plugin-list.php on line 57

I've modified this line from:

if ( ! in_array( esc_attr( $_GET[ 'plugin_status' ] ), self::$excluded_plugin_status ) ) {

to:

if ( ! isset( $_GET[ 'plugin_status ' ] ) || ! in_array( esc_attr( $_GET[ 'plugin_status' ] ), self::$excluded_plugin_status ) ) {

and I believe the issue is now resolved :)

plugin lost a core feature

Hi all!
I've updated the plugin to its latest version (1.3.6) and now on the list of plugins, it doesn't show the site were the plugins have been enabled (which is one of the more important features of the plugin).
Thanks!

WP icon disappearing from dashboard

I just noticed yesterday that the WP icon typically found in the top left-hand corner of the dashboard was not displaying in my multisite. Instead, I was seeing the address of the image printed out as text.

I did some playing around with plugins and disabled one called Branda by WPMU. This caused the text string to disappear, but there was no image at all then.

To experiment further, I disabled Multisite Enhancements and the icon immediately came back. Re-enabling it caused it to disappear again, and disabling it again caused the icon to return again.

This is the extent of the testing I've been able to do. I looked at the styles in Inspector for id="wp-admin-bar-wp-logo" and I see that this list item is disappearing when the plugin is enabled, so I don't think the problem is that it is somehow being hidden. It is just not being called.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.