Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"config": {
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": false,
"SCRIPT_DEBUG": true,
"WP_DEBUG_LOG": "/tmp/wp-errors.log",
"FS_METHOD": "direct",
Expand Down
14 changes: 14 additions & 0 deletions wp-content/plugins/wporg-learn/inc/sensei.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@
add_action( 'sensei_before_main_content', __NAMESPACE__ . '\theme_wrapper_start' );
add_action( 'sensei_after_main_content', __NAMESPACE__ . '\theme_wrapper_end' );
add_action( 'init', __NAMESPACE__ . '\wporg_correct_sensei_slugs' );
add_action( 'init', __NAMESPACE__ . '\wporg_correct_sensei_editor_permissions' );

/**
* Remove Sensei's default module editor permissions.
* See https://github.com/WordPress/Learn/issues/2331
*
* @return void
*/
function wporg_correct_sensei_editor_permissions() {
if ( current_user_can( 'editor' ) ) {
remove_filter( 'get_terms', array( Sensei()->modules, 'filter_module_terms' ), 20, 3 );
remove_filter( 'get_object_terms', array( Sensei()->modules, 'filter_course_selected_terms' ), 20, 3 );
}
}

/**
* Slugs in Sensei are translatable, which won't work for our site and the language switcher.
Expand Down