-
Notifications
You must be signed in to change notification settings - Fork 106
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
Activation/Deactivation methods #2698
Comments
Lesson Development Checklist
|
@jonathanbossenger I think training developers to use the activation and deactivation hooks for adding and removing data is quite risky for our ecosystem since my understanding is that is not the intended user experience in wp-admin. I think your code example is more appropriate in discussion of the uninstallation hook since that is typically when plugin data should actually be removed. I believe the Cron lesson comes later in the course, but my understanding is the activation and deactivation hooks are best used for adding and cleaning up side-effects, similar to Is there a more appropriate code sample that could be provided for this lesson? |
@MichelleBlanchette, thanks for your feedback; you do raise a valid point. In this specific code example, it could be argued that the addition of the option in the database is a side effect of activating the plugin, and so, depending on the plugin's specific requirements, removing that option on deactivation could make sense. The other problem is, this plugin is not something someone might build in the real world. One of the main reasons I went with a very simplified code example in this lesson is that it's easy to test that the deactivation code has worked. The learner can check the table and see that the option has been removed. That's always the problem with example code: It's generally not a real-world solution with all the considerations that go with it. One thing I had planned on doing was including a section in the Uninstall Methods lesson, which is right after this one, on when it's generally recommended to use deactivation vs. uninstallation. So perhaps a short section at the end of this lesson covering these considerations would help? This can also be used to direct learners to the next lesson, which could then also cover these considerations further. |
@jonathanbossenger I like the idea of leaving a little cliffhanger at the end, like you're kind of saying, that encourages moving on to the next lesson about uninstallation. I think that could work. Thanks! |
Great. I'll work on getting the script updated. |
Added section on Plugin deactivation and data cleanup |
Looks great @jonathanbossenger ~ Thank you for that! |
Hi team, I would like to be involved in editing this video 👍 |
Great stuff, thanks @agiljulio I have assigned you to the issue. |
Video link for review: https://drive.google.com/file/d/1YyCHMApYSBquN_sgUFUisKCn6iLrVv_E/view?usp=sharing |
Thanks @agiljulio looks good to me. I've announced this in the training team Slack channel for public review. |
@jonathanbossenger looks good to me. I liked the final note that, activation / deactivation hooks don't work with CLI. |
This is a nice overview. I'm wondering if it would be a good idea to mention that if you want to give users the ability to delete on deactivation, that you add an option to your plugins settings. Something like "Delete all plugin data on deactivation" Which you see in some plugins. Please tick all items you've confirmed:
|
Tutorial/Lessons Review ChecklistPlease tick all items you've confirmed:
I have some feedback particularly on the visuals:
|
Thanks for the feedback everyone.
@digitalchild I did think of that. However I figured that would lead to more questions (How would I do this, how to create modals inside WordPress etc) and therefore ultimately left this out.
@agiljulio this is a valid point. It could be PHP Intelephense or a PHPCS related extension. Are you able to disable those inline code error notifications? When looking at these sections, I also noticed that you're creating these files inside a theme directory, so all the theme-related files are showing in the file navigator panel. It might make more sense to have them located in a separate plugin directory.
@MichelleBlanchette this is an interesting one, and I think it's down to each video creator and learner. In this specific case I think it's ok, because the main reason this section exists is to direct folks to the uninstall lesson anyway. |
Details
Prerequisites
It is assumed that the learner has already completed the following lessons:
Learning Objectives
Related Resources and Other Notes
Automation Code
//lesson
The text was updated successfully, but these errors were encountered: