From 1bedb05d44c208a27a41014b2df01c8f7e297131 Mon Sep 17 00:00:00 2001 From: Hugh Lashbrooke Date: Fri, 27 Jun 2014 06:59:50 +0200 Subject: [PATCH 1/6] Fixing validation for multicheck settings fields Fixes #410 --- classes/class-woothemes-sensei-settings-api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/class-woothemes-sensei-settings-api.php b/classes/class-woothemes-sensei-settings-api.php index 587d6f7345..47a1020a6f 100755 --- a/classes/class-woothemes-sensei-settings-api.php +++ b/classes/class-woothemes-sensei-settings-api.php @@ -660,6 +660,7 @@ public function validate_fields ( $input ) { foreach ( $this->fields as $k => $v ) { // Make sure checkboxes are present even when false. if ( $v['type'] == 'checkbox' && ! isset( $input[$k] ) ) { $input[$k] = false; } + if ( $v['type'] == 'multicheck' && ! isset( $input[$k] ) ) { $input[$k] = false; } if ( isset( $input[$k] ) ) { // Perform checks on required fields. From feb9a2f6077068dd6d9b07293adf79866979d18b Mon Sep 17 00:00:00 2001 From: Hugh Lashbrooke Date: Fri, 27 Jun 2014 07:38:37 +0200 Subject: [PATCH 2/6] Making sure Learner Management shows for Teachers --- classes/class-woothemes-sensei-learners.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-woothemes-sensei-learners.php b/classes/class-woothemes-sensei-learners.php index 46496d09bf..ab0fe1d6f0 100755 --- a/classes/class-woothemes-sensei-learners.php +++ b/classes/class-woothemes-sensei-learners.php @@ -84,7 +84,7 @@ public function __construct ( $file ) { public function learners_admin_menu() { global $menu; - if ( current_user_can( 'manage_sensei' ) ) { + if ( current_user_can( 'manage_sensei_grades' ) ) { $learners_page = add_submenu_page( 'sensei', $this->name, $this->name, 'manage_sensei_grades', $this->page_slug, array( $this, 'learners_page' ) ); } From 8a4cd8c9ed23c1eca408cd232ee482fac7dd0d45 Mon Sep 17 00:00:00 2001 From: Hugh Lashbrooke Date: Fri, 27 Jun 2014 12:16:52 +0200 Subject: [PATCH 3/6] Updating changelog and bumping version Adding WP version compat to plugin header --- changelog.txt | 4 ++++ woothemes-sensei.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2efdddb7ee..ca5047f1ec 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ *** Sensei Changelog *** +2014.06.30 - version 1.6.1 + * Fix - Making sure Learner Management page shows for users with 'manage_sensei_grades' capability + * Fix - Fixing bug that prevented all email notifications from being deactivated + 2014.06.25 - version 1.6.0 * New - Comprehensive question bank functionality including question categories, the ability to re-use questions in multiple quizzes and bulk adding questions from a category * New - New Learner Management dashboard that allows administrators to add/remove learners to/from any course or lesson diff --git a/woothemes-sensei.php b/woothemes-sensei.php index f7add700b4..ed9bba78b7 100644 --- a/woothemes-sensei.php +++ b/woothemes-sensei.php @@ -3,10 +3,12 @@ Plugin Name: Sensei Plugin URI: http://www.woothemes.com/products/sensei/ Description: A course management plugin that offers the smoothest platform for helping you teach anything. -Version: 1.6.0 +Version: 1.6.1 Author: WooThemes Author URI: http://www.woothemes.com/ License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +Requires at least: 3.9 +Tested up to: 3.9.1 */ /* Copyright 2013 WooThemes (email : info@woothemes.com) @@ -35,7 +37,7 @@ global $woothemes_sensei; $woothemes_sensei = new WooThemes_Sensei( __FILE__ ); - $woothemes_sensei->version = '1.6.0'; + $woothemes_sensei->version = '1.6.1'; /** * Plugin updates From a32c918eac3bee7c4e7aeb24c078c698ff3f2a64 Mon Sep 17 00:00:00 2001 From: Dan Johnson Date: Fri, 4 Jul 2014 11:54:28 +0100 Subject: [PATCH 4/6] Fixes lesson order in single lesson navigation when using modules. Closes #411 --- changelog.txt | 1 + inc/woothemes-sensei-template.php | 77 ++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index ca5047f1ec..e6995dd86b 100755 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ 2014.06.30 - version 1.6.1 * Fix - Making sure Learner Management page shows for users with 'manage_sensei_grades' capability * Fix - Fixing bug that prevented all email notifications from being deactivated + * Fix - Fixing lesson order in single lesson next/previous lesson navigation 2014.06.25 - version 1.6.0 * New - Comprehensive question bank functionality including question categories, the ability to re-use questions in multiple quizzes and bulk adding questions from a category diff --git a/inc/woothemes-sensei-template.php b/inc/woothemes-sensei-template.php index ef193cc05b..294adef314 100755 --- a/inc/woothemes-sensei-template.php +++ b/inc/woothemes-sensei-template.php @@ -502,23 +502,86 @@ function sensei_get_prev_next_lessons( $lesson_id = 0 ) { if ( 0 < $lesson_id ) { // Get the List of Lessons in the Course $lesson_course_id = get_post_meta( $lesson_id, '_lesson_course', true ); - $course_lessons = $woothemes_sensei->frontend->course->course_lessons( $lesson_course_id ); - // Index the Lessons - if ( 0 < count( $course_lessons ) ) { + $all_lessons = array(); + if( class_exists( 'Sensei_Modules' ) ) { + global $sensei_modules; + + $modules = $sensei_modules->get_course_modules( intval( $lesson_course_id ) ); + + foreach( $modules as $module ) { + + $args = array( + 'post_type' => 'lesson', + 'post_status' => 'publish', + 'posts_per_page' => -1, + 'meta_query' => array( + array( + 'key' => '_lesson_course', + 'value' => intval( $lesson_course_id ), + 'compare' => '=' + ) + ), + 'tax_query' => array( + array( + 'taxonomy' => $sensei_modules->taxonomy, + 'field' => 'id', + 'terms' => intval( $module->term_id ) + ) + ), + 'meta_key' => '_order_module_' . $module->term_id, + 'orderby' => 'meta_value_num date', + 'order' => 'ASC', + 'suppress_filters' => 0 + ); + + $lessons = get_posts( $args ); + if ( 0 < count( $lessons ) ) { + foreach ($lessons as $lesson_item){ + $all_lessons[] = $lesson_item->ID; + } // End For Loop + } // End If Statement + } + } + + $args = array( + 'post_type' => 'lesson', + 'posts_per_page' => -1, + 'suppress_filters' => 0, + 'meta_key' => '_order_' . $lesson_course_id, + 'orderby' => 'meta_value_num date', + 'order' => 'ASC', + 'meta_query' => array( + array( + 'key' => '_lesson_course', + 'value' => intval( $lesson_course_id ), + ), + ), + 'post__not_in' => $all_lessons, + ); + + $other_lessons = get_posts( $args ); + if ( 0 < count( $other_lessons ) ) { + foreach ($other_lessons as $lesson_item){ + $all_lessons[] = $lesson_item->ID; + } // End For Loop + } // End If Statement + + if ( 0 < count( $all_lessons ) ) { $found_index = false; - foreach ($course_lessons as $lesson_item){ + foreach ( $all_lessons as $lesson ){ if ( $found_index && $return_values['next_lesson'] == 0 ) { - $return_values['next_lesson'] = $lesson_item->ID; + $return_values['next_lesson'] = $lesson; } // End If Statement - if ( $lesson_item->ID == $lesson_id ) { + if ( $lesson == $lesson_id ) { // Is the current post $found_index = true; } // End If Statement if ( !$found_index ) { - $return_values['prev_lesson'] = $lesson_item->ID; + $return_values['prev_lesson'] = $lesson; } // End If Statement } // End For Loop } // End If Statement + } // End If Statement return $return_values; } // End sensei_get_prev_next_lessons() From 15cf2691efac9fd220026a6bb0db5481a3f0e29b Mon Sep 17 00:00:00 2001 From: Dan Johnson Date: Fri, 4 Jul 2014 12:06:08 +0100 Subject: [PATCH 5/6] Ensures learner search works without WooCommerce. Closes #412 --- changelog.txt | 1 + classes/class-woothemes-sensei-learners.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index ca5047f1ec..8cbc7818da 100755 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ 2014.06.30 - version 1.6.1 * Fix - Making sure Learner Management page shows for users with 'manage_sensei_grades' capability * Fix - Fixing bug that prevented all email notifications from being deactivated + * Fix - Making sure learner management user search works without WooCommerce activated 2014.06.25 - version 1.6.0 * New - Comprehensive question bank functionality including question categories, the ability to re-use questions in multiple quizzes and bulk adding questions from a category diff --git a/classes/class-woothemes-sensei-learners.php b/classes/class-woothemes-sensei-learners.php index ab0fe1d6f0..1bf532f395 100755 --- a/classes/class-woothemes-sensei-learners.php +++ b/classes/class-woothemes-sensei-learners.php @@ -324,7 +324,7 @@ public function json_search_users() { check_ajax_referer( 'search-users', 'security' ); - $term = wc_clean( stripslashes( $_GET['term'] ) ); + $term = sanitize_text_field( stripslashes( $_GET['term'] ) ); if ( empty( $term ) ) { die(); From 6d5adcc07102dcd9f501e2a129070f31828a9fa3 Mon Sep 17 00:00:00 2001 From: Dan Johnson Date: Fri, 4 Jul 2014 12:27:42 +0100 Subject: [PATCH 6/6] Ensures modules display on courses with prerequisites. Closes #413 --- changelog.txt | 1 + templates/content-no-permissions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index ca5047f1ec..9ddc18c6bc 100755 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ 2014.06.30 - version 1.6.1 * Fix - Making sure Learner Management page shows for users with 'manage_sensei_grades' capability * Fix - Fixing bug that prevented all email notifications from being deactivated + * Fix - Ensuring that modules display on single course page for courses with prerequisites 2014.06.25 - version 1.6.0 * New - Comprehensive question bank functionality including question categories, the ability to re-use questions in multiple quizzes and bulk adding questions from a category diff --git a/templates/content-no-permissions.php b/templates/content-no-permissions.php index 1a10b74f22..bdffdb353d 100644 --- a/templates/content-no-permissions.php +++ b/templates/content-no-permissions.php @@ -33,7 +33,7 @@ - +