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

Allow additional users to manage students #7700

Merged
merged 10 commits into from
Nov 4, 2024

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented Nov 1, 2024

Part of https://github.com/Automattic/sensei-pro/issues/2618.

Proposed Changes

Add a filter to allow additional users to manage students (admins and teacher are the default).

Instead of using a hook, I debated changing the manage_sensei check to manage_sensei_grades, but this cap feels like it should be restricted to the Grading menu based on its naming. Perhaps we could consider adding a new one for student management in the future?

I was only able to add a couple of test cases, as most of the functions that were changed call exit, so I tested the use cases where return is called before an exit.

Testing Instructions

See https://github.com/Automattic/sensei-pro/pull/2619.

New/Updated Hooks

  • sensei_learners_allowed_user_ids - Filter the user IDs that have permission to manage students.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@donnapep donnapep self-assigned this Nov 1, 2024
@donnapep donnapep added this to the 4.24.4 milestone Nov 1, 2024
Copy link

github-actions bot commented Nov 1, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 1, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 1, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 1, 2024

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep added the Hooks This change adds or modifies one or more hooks. label Nov 1, 2024
@donnapep donnapep requested a review from a team November 1, 2024 19:42
Copy link

github-actions bot commented Nov 2, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 2, 2024

Test the previous changes of this PR with WordPress Playground.

m1r0
m1r0 previously approved these changes Nov 4, 2024
Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

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

Looks good overall. I've left one very small comment.

For the hook, I would have gone with filtering the $can_manage_student value instead of filtering the user IDs to keep things simpler, but I'm OK either way. 🙂

includes/admin/class-sensei-learner-management.php Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Nov 4, 2024

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep merged commit afc74b1 into trunk Nov 4, 2024
22 checks passed
@donnapep donnapep deleted the add/filter-student-management-teacher-ids branch November 4, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hooks This change adds or modifies one or more hooks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants