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

LTW Editor custom user role #156

Merged
merged 3 commits into from
Jul 2, 2020
Merged

LTW Editor custom user role #156

merged 3 commits into from
Jul 2, 2020

Conversation

joshdarby
Copy link

@joshdarby joshdarby commented Jul 1, 2020

Changes

This pull request makes the following changes:

  • Adds a new LTW Editor custom role for users to be able to add, manage, update, delete LTW projects and their taxonomies

Why

For #152

Testing/Questions

Features that this PR affects:

  • New custom user role
  • Capabilities for projects and project taxonomies

Questions that need to be answered before merging:

  • Is this PR targeting the correct branch in this repository?
  • NOTE: WP 5.4.2 needs to be installed for this to work correctly
  • Any security concerns?
  • I added the new projects capabilities to administrator and editor roles as well. Do we need to add it to any other roles?
  • Why is the landing page CPT showing for users with this role? Removing
'manage_terms'  => 'edit_projects',
'edit_terms'    => 'edit_projects',
'delete_terms'  => 'edit_projects',
'assign_terms'  => 'edit_projects',

from the taxonomies fixes the issue, but why?

Steps to test this PR:

  1. Create a new user using the LTW Editor role
  2. Attempt to add, update, delete LTW projects and taxonomies
  3. Make sure everything works as expected
  4. Try all of the above as an administrator and editor as well

@joshdarby joshdarby added this to the INOV-001 milestone Jul 1, 2020
@joshdarby joshdarby requested a review from benlk July 1, 2020 16:45
@joshdarby joshdarby self-assigned this Jul 1, 2020
@benlk
Copy link
Collaborator

benlk commented Jul 1, 2020

With the exception of the Landing Pages bit, this all makes sense.

Why is the landing page CPT showing for users with this role? Removing ... from the taxonomies fixes the issue, but why?

This might be because Largo indiscriminately registers taxonomies for the landing page post type, rather than only registering it for specific taxonomies:

https://github.com/INN/largo/blob/c41d8519370b48a6e53ce36b3b516d3e54e39d66/inc/wp-taxonomy-landing/functions/cftl-admin.php#L77-L84

We could add an action running at an even later priority to unregister the taxonomy for the cftl-tax-landing post type. https://developer.wordpress.org/reference/functions/unregister_taxonomy_for_object_type/

@joshdarby
Copy link
Author

@benlk Good call on that. Updated in 2c54997 and it seems to have done the trick.

@joshdarby joshdarby merged commit 9900bff into staging Jul 2, 2020
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