Hide the My Lessons menu for users who already see Scheduler
CI / Tests (PHP 8.1) (pull_request) Successful in 42s
CI / Tests (PHP 8.2) (pull_request) Successful in 39s
CI / No Debug Code (pull_request) Successful in 1s
CI / Coding Standards (pull_request) Successful in 2m46s
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m34s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.1) (pull_request) Successful in 42s
CI / Tests (PHP 8.2) (pull_request) Successful in 39s
CI / No Debug Code (pull_request) Successful in 1s
CI / Coding Standards (pull_request) Successful in 2m46s
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m34s
CI / Build Plugin Zip (pull_request) Skipped
Scheduler (view_all_lessons) is a superset of My Lessons — same template, every instructor's lessons, same payment edit forms — so for an owner-operator both menu items showed the same data twice. The My Lessons menu item is now only registered for users without view_all_lessons; instructors are unaffected. Closes #85 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -80,7 +80,7 @@ kind `group_class`; see `group-classes.md`.
|
||||
|
||||
## Admin Interface
|
||||
- **Scheduler** (`view_all_lessons` — studio admin / administrators): all upcoming lessons across all instructors
|
||||
- **My Lessons** (`view_own_lessons`): upcoming lessons for the logged-in instructor
|
||||
- **My Lessons** (`view_own_lessons`): upcoming lessons for the logged-in instructor. Hidden for users who also hold `view_all_lessons` — Scheduler is a superset, so the menu item would only duplicate it.
|
||||
|
||||
Both pages open in a **Week** calendar view by default (`usc_view`/`usc_week`
|
||||
query params, same pattern as the availability page, bucketed via
|
||||
|
||||
+15
-10
@@ -233,16 +233,21 @@ class AdminMenu {
|
||||
30.5
|
||||
);
|
||||
|
||||
// Instructor: view their upcoming lessons.
|
||||
add_menu_page(
|
||||
__( 'My Lessons', 'unsupervised-schedular' ),
|
||||
__( 'My Lessons', 'unsupervised-schedular' ),
|
||||
RoleManager::CAP_VIEW_LESSONS,
|
||||
'us-my-lessons',
|
||||
[ $this->lessonController, 'renderInstructorLessons' ],
|
||||
'dashicons-welcome-learn-more',
|
||||
42
|
||||
);
|
||||
// Instructor: view their upcoming lessons. Hidden for anyone who can
|
||||
// already see the Scheduler — it shows every instructor's lessons
|
||||
// (including their own, with the same payment edit forms), so the two
|
||||
// menu items would just duplicate each other for an owner-operator.
|
||||
if ( ! current_user_can( RoleManager::CAP_VIEW_ALL_LESSONS ) ) {
|
||||
add_menu_page(
|
||||
__( 'My Lessons', 'unsupervised-schedular' ),
|
||||
__( 'My Lessons', 'unsupervised-schedular' ),
|
||||
RoleManager::CAP_VIEW_LESSONS,
|
||||
'us-my-lessons',
|
||||
[ $this->lessonController, 'renderInstructorLessons' ],
|
||||
'dashicons-welcome-learn-more',
|
||||
42
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user