Skip to content

Remove portfolio roles during cleanup#270

Merged
nk-o merged 5 commits into
masterfrom
fix/remove-user-roles-after-uninstall
Jun 8, 2026
Merged

Remove portfolio roles during cleanup#270
nk-o merged 5 commits into
masterfrom
fix/remove-user-roles-after-uninstall

Conversation

@Fellan-91

Copy link
Copy Markdown
Collaborator

Summary

Remove Visual Portfolio custom roles when they are no longer needed.

What changed

  • sync portfolio roles and capabilities with the register_portfolio_post_type setting
  • remove Portfolio Author and Portfolio Manager when the Portfolio CPT is disabled
  • keep Saved Layouts admin access intact when only the Portfolio CPT is disabled
  • add uninstall.php cleanup to remove plugin roles and capabilities on uninstall
  • add PHPUnit coverage for role sync and full cleanup behavior

Verification

  • verified live in local WordPress admin by disabling Register Portfolio Post Type
  • confirmed Portfolio Author and Portfolio Manager disappear from Users > Add New
  • re-enabled the setting and confirmed both roles return
  • ran php -l for changed PHP files

Notes

This follows the explicit create/remove role lifecycle pattern used by WooCommerce, instead of only adding capabilities on init.

@blacksmith-sh

This comment has been minimized.

Fellan-91 and others added 4 commits May 26, 2026 17:22
Remove only Portfolio Author and portfolio capabilities when the post type
is turned off, so managers can still edit Saved Layouts. Full role cleanup
remains on uninstall only.
@nk-o nk-o merged commit 87b981b into master Jun 8, 2026
9 checks passed
@nk-o nk-o deleted the fix/remove-user-roles-after-uninstall branch June 8, 2026 13:04
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.

2 participants