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

Feature 681: Adding uninstall method #716

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

bluecollarcoders
Copy link
Collaborator

@bluecollarcoders bluecollarcoders commented Jun 28, 2024

Description of the Change

This PR adds an uninstall method to clear out any plugin options, settings specific to the plugin, and/or other database entities such as tables.

Where possible, please also include:

  • verification steps to ensure your change has the desired effects and has not introduced any regressions
  • any benefits that will be realized
  • any alternative implementations or possible drawbacks that you considered
  • screenshots or screencasts

Closes #

How to test the Change

Changelog Entry

Added - New feature

Credits

Props @bluecollarcoders

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

global $wpdb;

// Delete Options.
$option_name = 'wporg_option';
Copy link
Contributor

Choose a reason for hiding this comment

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

This was just an example. We need to remove things we store in the options table (GatherPress settings). In addition to deleting options, should delete user meta, taxonomies, events, venues, etc. Some things like post meta will be deleted automatically with the posts. We might want to delete things in options table by looking for anything that prepends with gatherpress_. What do you think @carstingaxion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I especially liked about the linked implementation was:

  • additional check if plugin is network-enabled
  • deletion of user_meta

In addition:

For the multiple options I suggest an array function like array_walk calling delete_option on the list of all options and transients as well.

@carstingaxion carstingaxion linked an issue Aug 28, 2024 that may be closed by this pull request
1 task
Copy link

Preview changes with Playground

You can preview the least recent changes for PR#716 by following one of the links below:

⚠️ Note: The preview sites are created using WordPress Playground. You can add content, edit settings, and test the themes as you would on a real site, but please note that changes are not saved between sessions.

@mauteri mauteri changed the base branch from main to develop October 10, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add uninstall.php or uninstall routine
3 participants