LLMS_Admin_Menus::instructor_menu_hack()
Removes edit.php from the admin menu for instructors/asst instructors
Description Description
Note: The post screen is still technically accessible.
Posts will need to be submitted for review as the instructors only actually have the capability of a contributor with regards to posts but this hack will allow instructors to publish new lessons, quizzes, & questions.
Return Return
(void)
Source Source
File: includes/admin/class.llms.admin.menus.php
public function instructor_menu_hack() {
/**
* Filters the WP_User roles should receive the instructor admin menu hack.
*
* If you wish to provide explicit access to the `post` post type, to the
* instrutor or instructor's assistant role, the role will need to be
* removed from this array so they can access to the post type edit.php
* screen.
*
* @see LLMS_Admin_Menus::instructor_menu_hack
*
* @since 7.0.1
*
* @param string[] $roles The list of WP_User roles which need the hack.
*/
$roles = apply_filters( 'llms_instructor_menu_hack_roles', array( 'instructor', 'instructors_assistant' ) );
$user = wp_get_current_user();
if ( array_intersect( $roles, $user->roles ) ) {
remove_menu_page( 'edit.php' );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.0.1 | Added filterable early return allowing 3rd parties to modify the user roles affected by this hack. |
| 3.13.0 | Introduced. |