fix(relationships): clean up post dependencies on permanent delete - #3264
Open
faisalahammad wants to merge 1 commit into
Open
fix(relationships): clean up post dependencies on permanent delete#3264faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
- Add course prerequisite unset on other courses when course deleted - Add course ID removal from membership auto-enroll arrays - Add child section force-deletion when course is deleted - Add lesson parent-course meta unset when course is deleted - Add section parent-section meta unset on lessons when section deleted - Add membership ID removal from post restriction arrays (_llms_restricted_levels) - Add membership ID removal from access plan availability restrictions (_llms_availability_restrictions) - Add sitewide membership option (lifterlms_membership_required) cleanup on membership deletion - Add remove_from_meta action type for serialized array meta cleanup - Add get_posts_with_meta_containing() helper using LIKE pre-filter - Add unit test coverage for all new cleanup paths Fixes gocodebox#263
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Cleans up stale cross-post references when LifterLMS posts are permanently deleted. Previously, deleting a course, section, lesson, or membership left behind prerequisite links, membership auto-enroll entries, restriction arrays, parent meta, and the sitewide membership option pointing at the deleted post.
Hooks into the existing
delete_postflow inLLMS_Post_Relationships(same place access plans and quiz/question cleanup already run). Adds aremove_from_metaaction for serialized array meta and aget_posts_with_meta_containing()helper with a LIKE pre-filter.Cleanup paths added
Course deleted
Section deleted
Membership deleted
_llms_restricted_levels)_llms_availability_restrictions)lifterlms_membership_requiredoption when it matchesOut of scope (this PR)
wp_trash_post) — cleanup runs on permanent delete only, matching existing relationship handlersHow has this been tested?
tests/phpunit/unit-tests/class-llms-test-post-relationships.phpfor each cleanup pathScreenshots / Screencasts
N/A — backend relationship cleanup only.
Types of changes
Checklist:
Fixes #263