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

VaultPress: if Rewind is enabled, remove its entry in sidebar and hide its notice #9056

Merged
merged 2 commits into from
Mar 19, 2018

Conversation

eliorivero
Copy link
Contributor

Fixes #8691

This PR fixes issues with VaultPress deactivation driven by Jetpack when Rewind is active:

Proposed changes

The Jetpack menu was previously still showing the VaultPress submenu and clicking it lead to a blank page. This is now fixed here.

The notice saying "VaultPress needs your attention!" was still shown before, but it's now hidden. It was complex to remove it since it wasn't possible to remove the actions hooked to user_admin_notices and admin_notices. To overcome this, a <style> tag was added with a rule to hide the notice.

Updated PHPDocs.

Testing instructions:

  1. test with a site with Rewind active
  2. activate the VaultPress plugin. It will be automatically deactivated and a notice will show.
  3. ensure that:
    • there's not a VaultPress submenu entry under the Jetpack menu
    • the notice VaultPress needs your attention! is not visible

Proposed changelog entry for your changes:

VaultPress: menu item going nowhere is now suppressed.

…vate it, hide the notice that requested attention, and show a notification s.
@eliorivero eliorivero added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. [Focus] FixTheFlows [Feature] Backup & Scan labels Mar 15, 2018
@eliorivero eliorivero added this to the 6.0 milestone Mar 15, 2018
@eliorivero eliorivero self-assigned this Mar 15, 2018
@eliorivero eliorivero requested a review from a team as a code owner March 15, 2018 01:20
function jetpack_vaultpress_rewind_check() {
if ( Jetpack::is_active() &&
Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' ) &&
Jetpack::is_rewind_enabled()
) {
remove_submenu_page( 'jetpack', 'vaultpress' );

deactivate_plugins( 'vaultpress/vaultpress.php' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this to here is probably a bad idea.

We had intentionally left it in the notice function, as there may be pages that admin_init runs on (such as admin_ajax) that would otherwise deactivate the plugin without the notification explaining ever being shown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'll make the change and will add a comment explaining why it's there.

@georgestephanis georgestephanis added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Mar 19, 2018
@zinigor zinigor merged commit 1991d5a into master Mar 19, 2018
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Mar 19, 2018
@zinigor zinigor deleted the update/remove-vp-notice-menu-entry branch March 19, 2018 16:11
oskosk added a commit that referenced this pull request Mar 23, 2018
dereksmart pushed a commit that referenced this pull request Mar 27, 2018
* Changelog 6.0: create base for changelog.

* Add #8938 to changelog

* Add #8962 to changelog

* Add #8974 to changelog

* Add #8975 to changelog

* Add #8978 to changelog

* Add #8867 to changelog

* Add #8937 to changelog

* Add #8961 to changelog

* Add #8855 to changelog

* Add #8944 to changelog

* Add #8973 to changelog

* Add #8977 to changelog

* Add #8979 to changelog

* Add #8980 to changelog

* Add #8982 to changelog

* Add #8983 to changelog

* Add #8984 to changelog

* Add #8986 to changelog

* Add #9005 to changelog

* Add #9010 to changelog

* Add #9012 to changelog

* Add #9021 to changelog

* Add #9022 to changelog

* Add #9056 to changelog

* Add #9061 to changelog

* Add #9079 to changelog

* Add #9080 to changelog

* Add #9088 to changelog

* Add #9096 to changelog

* Add #9097 to changelog

* Add #9100 to changelog

* Add #9107 to changelog

* Add #8969 to changelog

* Add #8993 to changelog

* Add #9003 to changelog

* Add #9031 to changelog

* Add #8945 to changelog

* Add #9052 to changelog

* Add #9058 to changelog

* Add #9066 to changelog

* Add #9076 to changelog

* Add #9053 to changelog

* Add #9108 to changelog

* Add #9135 to changelog

* Add #9148 to changelog

* Add #9125 to changelog

* Add #9137 to changelog

* Added testing instructions for 6.0.

* Added IS testing instructions, huge props to @tiagonoronha.

* Added #8498 to changelog.

* Added #8954 to changelog.

* Added #8985 to changelog.

* add #9027

* add #9112 to changelog

* add #9136 to changelog

* add #9102 to changelog

* add #9093 to changelog

* add #9062 to changelog

* add #9172 to changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Backup & Scan [Focus] FixTheFlows [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove VaultPress side menu item when deactivating
5 participants