-
Notifications
You must be signed in to change notification settings - Fork 796
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
Sidebar menu: Register "plugin install" route on sites with the default interface #37686
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) { | ||
$update_data = wp_get_update_data(); | ||
$count = sprintf( | ||
'<span class="update-plugins count-%s"><span class="plugin-count">%s</span></span>', | ||
$update_data['counts']['plugins'], | ||
number_format_i18n( $update_data['counts']['plugins'] ) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some logic that we copy/pasted from a file that was shared between Simple and Atomic sites. For Simple sites, we don't need this logic (is_multisite
always returns true), which is why I didn't incorporated into the jetpack-mu-wpcom package.
if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) { | ||
$update_data = wp_get_update_data(); | ||
$count = sprintf( | ||
'<span class="update-plugins count-%s"><span class="plugin-count">%s</span></span>', | ||
$update_data['counts']['plugins'], | ||
number_format_i18n( $update_data['counts']['plugins'] ) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some logic that we copy/pasted from a file that was shared between Simple and Atomic sites. For Simple sites, we don't need this logic (is_multisite
always returns true), which is why I didn't incorporated into the jetpack-mu-wpcom package.
Are we 100% sure about this? What are the cons and pros of hiding the add new plugin page on the default admin interface? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as described, lets answer Richard's question before merging though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes work as described.
Not 100% sure, but it is what we decided when we launched Nav Unification a few years ago, so I just wanted to avoid revisiting that decision.
It makes total sense, but unfortunately it's not-so-trivial technically if the submenu remains hidden. |
Proposed changes:
In #37521 we added a new "Add New Plugin" submenu which is only registered on sites with the classic admin interface so we could redirect from
/wp-admin/plugin-install.php
to the route of that submenu (/wp-admin/plugins.php?page=wpcom-install-plugin
).However, for that redirect to work, we need the new route to be working on all Simple sites, including sites with the default admin interface (see pMz3w-k1d-p2#comment-119194).
Since we don't want the "Add New Plugin" submenu to be visible on sites with the default admin interface, this PR implements a workaround in which it registers the menu (on all sites) and then hides it (on sites with the default interface).
To simplify the workaround, the existing logic that registers the Plugins parent menu from Nav Unification to the jetpack-mu-wpcom package.
Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
No
Testing instructions:
/wp-admin/plugins.php?page=wpcom-install-plugin