Skip to content

Commit

Permalink
Merge pull request #422 from woothemes/release-1-6-1
Browse files Browse the repository at this point in the history
Release 1 6 1
  • Loading branch information
Dan Johnson committed Jul 11, 2014
2 parents 15c62c8 + 26568a3 commit 6d09140
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 12 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** 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
* Fix - Fixing lesson order in single lesson next/previous lesson navigation
* Fix - Ensuring that modules display on single course page for courses with prerequisites
* 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
* New - New Learner Management dashboard that allows administrators to add/remove learners to/from any course or lesson
Expand Down
4 changes: 2 additions & 2 deletions classes/class-woothemes-sensei-learners.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}

Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions classes/class-woothemes-sensei-settings-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
77 changes: 70 additions & 7 deletions inc/woothemes-sensei-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion templates/content-no-permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</section>

<?php course_single_meta(); ?>
<?php course_single_lessons(); ?>
<?php do_action( 'sensei_course_single_lessons' ); ?>

</article><!-- .post -->
<?php } else { ?>
Expand Down
6 changes: 4 additions & 2 deletions woothemes-sensei.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 : [email protected])
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6d09140

Please sign in to comment.