Skip to content

Commit

Permalink
Merge pull request #992 from woothemes/release-1-8-6
Browse files Browse the repository at this point in the history
Release 1 8 6
  • Loading branch information
dwainm committed Jul 17, 2015
2 parents e12dfda + f939017 commit 5689f85
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 57 deletions.
2 changes: 1 addition & 1 deletion assets/js/lesson-metadata.min.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
*** Sensei Changelog ***

2015.07.15 - version 1.8.6
* Fix - Failure to load the JS in admin page because there was an extra dot in the file name.
* Fix - a few Typos in comments and strings
* Fix - Remove special character and replace with \' instead
* Fix - change site_transients to normal transients and decrease the time from 30 days to 10
* Fix - Create a fallback for round with 3 parameters. Added a check to use to use only 2 parameter for php version below 5.3
* Tweak - Output course order via php instead of relying on JS to re-order on the front-end.

2015.06.18 - version 1.8.5
* Fix - Save the lesson preview checkbox unchecked state as well. The bug was that unchecked boxes does not get passed via $_POST in certain cases.
* Tweak - Allow the quiz results rounding to be filtered. So you can now have decimal points shown to the user instead of the rounded up amount.
Expand Down
10 changes: 5 additions & 5 deletions classes/class-sensei-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,8 +1314,8 @@ public function admin_enqueue_scripts ( $hook ) {

$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';

wp_enqueue_script('sensei-chosen', Sensei()->plugin_url . 'assets/chosen/chosen.jquery.' . $suffix . '.js', array('jquery'), Sensei()->version , true);
wp_enqueue_script('sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.' . $suffix . '.js', array('jquery','sensei-chosen'), Sensei()->version , true);
wp_enqueue_script('sensei-chosen', Sensei()->plugin_url . 'assets/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), Sensei()->version , true);
wp_enqueue_script('sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery' . $suffix . '.js', array('jquery','sensei-chosen'), Sensei()->version , true);
wp_enqueue_script($this->taxonomy . '-admin', esc_url($this->assets_url) . 'js/modules-admin' . $suffix . '.js', array('jquery','sensei-chosen','sensei-chosen-ajax', 'jquery-ui-sortable'), Sensei()->version, true);

//localized module data
Expand Down Expand Up @@ -1546,9 +1546,9 @@ public function get_none_module_lessons( $course_id ){
}

//save some time and check if we already have the saved
if( get_site_transient( 'sensei_'. $course_id .'_none_module_lessons') ){
if( get_transient( 'sensei_'. $course_id .'_none_module_lessons') ){

return get_site_transient( 'sensei_'. $course_id .'_none_module_lessons');
return get_transient( 'sensei_'. $course_id .'_none_module_lessons');

}

Expand Down Expand Up @@ -1596,7 +1596,7 @@ public function get_none_module_lessons( $course_id ){

if( isset( $wp_lessons_query->posts) && count( $wp_lessons_query->posts ) > 0 ){
$non_module_lessons = $wp_lessons_query->get_posts();
set_site_transient( 'sensei_'. $course_id .'_none_module_lessons', $non_module_lessons, 20 );
set_transient( 'sensei_'. $course_id .'_none_module_lessons', $non_module_lessons, 10 * DAY_IN_SECONDS );
}

return $non_module_lessons;
Expand Down
19 changes: 17 additions & 2 deletions classes/class-woothemes-sensei-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,14 +978,29 @@ public function course_order_screen() {
}

$courses = Sensei()->course->get_all_courses();

if( 0 < count( $courses ) ) {

$order_string = $this->get_course_order();
// order the courses as set by the users
$all_course_ids = array();
foreach( $courses as $course ){

$all_course_ids[] = (string)$course->ID;

}
$order_string = $this->get_course_order();

if( !empty( $order_string ) ){
$ordered_course_ids = explode(',' , $order_string );
$all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) );
}


$html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n";
$html .= '<ul class="sortable-course-list">' . "\n";
$count = 0;
foreach ( $courses as $course ) {
foreach ( $all_course_ids as $course_id ) {
$course = get_post( $course_id );
$count++;
$class = 'course';
if ( $count == 1 ) { $class .= ' first'; }
Expand Down
2 changes: 1 addition & 1 deletion classes/class-woothemes-sensei-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ public function sensei_process_registration(){
// register user
$user_id = wp_create_user( $new_user_name, $new_user_password, $new_user_email );
if ( ! $user_id || is_wp_error( $user_id ) ) {
$woothemes_sensei->notices->add_notice( sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ), 'alert');
$woothemes_sensei->notices->add_notice( sprintf( __( '<strong>ERROR</strong>: Couldn\'t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ), 'alert');
}

// notify the user
Expand Down
4 changes: 2 additions & 2 deletions classes/class-woothemes-sensei-lesson.php
Original file line number Diff line number Diff line change
Expand Up @@ -2638,7 +2638,7 @@ public function lesson_quiz_questions( $quiz_id = 0, $post_status = 'any', $orde
$user_id = get_current_user_id();
}

// Set the default quesiton order if it has not already been set for this quiz
// Set the default question order if it has not already been set for this quiz
$this->set_default_question_order( $quiz_id );

// If viewing quiz on the frontend then show questions in random order if set
Expand Down Expand Up @@ -3214,4 +3214,4 @@ public function set_quick_edit_admin_defaults( $column_name, $post_id ){

}// end quick edit admin defaults

} // End Class
} // End Class
25 changes: 12 additions & 13 deletions classes/class-woothemes-sensei-quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function save_user_answers( $quiz_answers, $files = array(), $less

// save transient to make retrieval faster
$transient_key = 'sensei_answers_'.$user_id.'_'.$lesson_id;
set_site_transient( $transient_key, $prepared_answers, 30 * DAY_IN_SECONDS );
set_transient( $transient_key, $prepared_answers, 10 * DAY_IN_SECONDS );

// update the message showed to user
$woothemes_sensei->frontend->messages = '<div class="sensei-message note">' . apply_filters( 'sensei_quiz_saved_text', __( 'Quiz Saved Successfully.', 'woothemes-sensei' ) ) . '</div>';
Expand Down Expand Up @@ -246,7 +246,7 @@ public function get_user_answers( $lesson_id, $user_id ){

// save some time and get the transient cached data
$transient_key = 'sensei_answers_'.$user_id.'_'.$lesson_id;
$transient_cached_answers = get_site_transient( $transient_key );
$transient_cached_answers = get_transient( $transient_key );

// return the transient or get the values get the values from the comment meta
if( !empty( $transient_cached_answers ) && false != $transient_cached_answers ){
Expand All @@ -264,7 +264,7 @@ public function get_user_answers( $lesson_id, $user_id ){
}

//set the transient with the new valid data for faster retrieval in future
set_site_transient( $transient_key, $encoded_user_answers);
set_transient( $transient_key, $encoded_user_answers, 10 * DAY_IN_SECONDS);

// decode an unserialize all answers
foreach( $encoded_user_answers as $question_id => $encoded_answer ) {
Expand Down Expand Up @@ -498,9 +498,9 @@ public function reset_user_lesson_data( $lesson_id , $user_id = 0 ){
$answers_transient_key = 'sensei_answers_'.$user_id.'_'.$lesson_id;
$grades_transient_key = 'quiz_grades_'.$user_id.'_'.$lesson_id;
$answers_feedback_transient_key = 'sensei_answers_feedback_'.$user_id.'_'.$lesson_id;
delete_site_transient( $answers_transient_key );
delete_site_transient( $grades_transient_key );
delete_site_transient( $answers_feedback_transient_key );
delete_transient( $answers_transient_key );
delete_transient( $grades_transient_key );
delete_transient( $answers_feedback_transient_key );

// reset the quiz answers and feedback notes
$deleted_answers = WooThemes_Sensei_Utils::delete_user_data( 'quiz_answers', $lesson_id, $user_id );
Expand Down Expand Up @@ -764,7 +764,7 @@ public function set_user_grades( $quiz_grades, $lesson_id, $user_id = 0 ){
$success = true;
// save transient
$transient_key = 'quiz_grades_'. $user_id . '_' . $lesson_id;
set_site_transient( $transient_key, $quiz_grades, 30 * DAY_IN_SECONDS );
set_transient( $transient_key, $quiz_grades, 10 * DAY_IN_SECONDS );
}

return $success;
Expand Down Expand Up @@ -799,16 +799,15 @@ public function get_user_grades( $lesson_id, $user_id = 0 ){

// save some time and get the transient cached data
$transient_key = 'quiz_grades_'. $user_id . '_' . $lesson_id;
$user_grades = get_site_transient( $transient_key );
$user_grades = get_transient( $transient_key );

// get the data if nothing was stored in the transient
if( empty( $user_grades ) || false != $user_grades ){

$user_grades = WooThemes_Sensei_Utils::get_user_data( 'quiz_grades', $lesson_id, $user_id );

//set the transient with the new valid data for faster retrieval in future
set_site_transient( $transient_key, $user_grades);

set_transient( $transient_key, $user_grades, 10 * DAY_IN_SECONDS );

} // end if transient check

Expand Down Expand Up @@ -923,7 +922,7 @@ public function save_user_answers_feedback( $answers_feedback, $lesson_id , $use

// save transient to make retrieval faster in future
$transient_key = 'sensei_answers_feedback_'.$user_id.'_'.$lesson_id;
set_site_transient( $transient_key, $encoded_answers_feedback, 30 * DAY_IN_SECONDS );
set_transient( $transient_key, $encoded_answers_feedback, 10 * DAY_IN_SECONDS );

}

Expand Down Expand Up @@ -964,15 +963,15 @@ public function get_user_answers_feedback( $lesson_id , $user_id = 0 ){

// first check the transient to save a few split seconds
$transient_key = 'sensei_answers_feedback_'.$user_id.'_'.$lesson_id;
$encoded_feedback = get_site_transient( $transient_key );
$encoded_feedback = get_transient( $transient_key );

// get the data if nothing was stored in the transient
if( empty( $encoded_feedback ) || !$encoded_feedback ){

$encoded_feedback = WooThemes_Sensei_Utils::get_user_data( 'quiz_answers_feedback', $lesson_id, $user_id );

//set the transient with the new valid data for faster retrieval in future
set_site_transient( $transient_key, $encoded_feedback);
set_transient( $transient_key, $encoded_feedback, 10 * DAY_IN_SECONDS);

} // end if transient check

Expand Down
2 changes: 1 addition & 1 deletion classes/class-woothemes-sensei-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public function init_fields () {

$fields['learner_profile_enable'] = array(
'name' => __( 'Public learner profiles', 'woothemes-sensei' ),
'description' => sprintf( __( 'Enable public learner profiles that will be accassible to everyone. Profile URL format: %s', 'woothemes-sensei' ), $profile_url_example ),
'description' => sprintf( __( 'Enable public learner profiles that will be accessible to everyone. Profile URL format: %s', 'woothemes-sensei' ), $profile_url_example ),
'type' => 'checkbox',
'default' => true,
'section' => 'learner-profile-settings'
Expand Down
4 changes: 2 additions & 2 deletions classes/class-woothemes-sensei-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct ( $parent ) {
),
'1.6.0' => array( 'auto' => array( 'add_teacher_role' => array( 'title' => __( 'Add \'Teacher\' role', 'woothemes-sensei' ), 'desc' => __( 'Adds a \'Teacher\' role to your WordPress site that will allow users to mange the Grading and Analysis pages.', 'woothemes-sensei' ) ),
'add_sensei_caps' => array( 'title' => __( 'Add administrator capabilities', 'woothemes-sensei' ), 'desc' => __( 'Adds the \'manage_sensei\' and \'manage_sensei_grades\' capabilities to the Administrator role.', 'woothemes-sensei' ) ),
'restructure_question_meta' => array( 'title' => __( 'Restructure question meta data', 'woothemes-sensei' ), 'desc' => __( 'Restructures the quesiton meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+.', 'woothemes-sensei' ) ),
'restructure_question_meta' => array( 'title' => __( 'Restructure question meta data', 'woothemes-sensei' ), 'desc' => __( 'Restructures the question meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+.', 'woothemes-sensei' ) ),
'update_quiz_settings' => array( 'title' => __( 'Add new quiz settings', 'woothemes-sensei' ), 'desc' => __( 'Adds new settings to quizzes that were previously registered as global settings.', 'woothemes-sensei' ) ),
'reset_lesson_order_meta' => array( 'title' => __( 'Set default order of lessons', 'woothemes-sensei' ), 'desc' => __( 'Adds data to lessons to ensure that they show up on the \'Order Lessons\' screen - if this update has been run once before then it will reset all lessons to the default order.', 'woothemes-sensei' ) ), ),
'manual' => array()
Expand Down Expand Up @@ -1758,4 +1758,4 @@ public function enhance_teacher_role ( ) {

}// end enhance_teacher_role

} // End Class
} // End Class
14 changes: 13 additions & 1 deletion classes/class-woothemes-sensei-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2195,11 +2195,23 @@ public static function round( $val, $precision = 0, $mode = PHP_ROUND_HALF_UP, $
/**
* Change the mode for the Sensei_Utils::round function.
* the mode given will be passed into the php round function
*
* This applies only to PHP version 5.3.0 and greater
*
* @since 1.8.5
*/
$mode = apply_filters( 'sensei_round_mode', $mode , $val, $context, $precision );

return round( $val, $precision, $mode );
if ( version_compare(PHP_VERSION, '5.3.0') >= 0 ) {

return round( $val, $precision, $mode );

}else{

return round( $val, $precision );

}

}

} // End Class
18 changes: 5 additions & 13 deletions lang/woothemes-sensei.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the same license as the Sensei package.
msgid ""
msgstr ""
"Project-Id-Version: Sensei 1.8.4\n"
"Project-Id-Version: Sensei 1.8.5\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woothemes-sensei\n"
"POT-Creation-Date: 2015-06-17 15:09:48+00:00\n"
"POT-Creation-Date: 2015-07-15 14:20:38+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1189,7 +1189,7 @@ msgid "<strong>ERROR</strong>: The password field may not be empty, please enter
msgstr ""

#: classes/class-woothemes-sensei-frontend.php:1974
msgid "<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href=\"mailto:%s\">webmaster</a> !"
msgid "<strong>ERROR</strong>: Couldn't register you&hellip; please contact the <a href=\"mailto:%s\">webmaster</a> !"
msgstr ""

#: classes/class-woothemes-sensei-frontend.php:2012
Expand Down Expand Up @@ -2725,7 +2725,7 @@ msgid "Public learner profiles"
msgstr ""

#: classes/class-woothemes-sensei-settings.php:405
msgid "Enable public learner profiles that will be accassible to everyone. Profile URL format: %s"
msgid "Enable public learner profiles that will be accessible to everyone. Profile URL format: %s"
msgstr ""

#: classes/class-woothemes-sensei-settings.php:412
Expand Down Expand Up @@ -2978,7 +2978,7 @@ msgid "Restructure question meta data"
msgstr ""

#: classes/class-woothemes-sensei-updates.php:66
msgid "Restructures the quesiton meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+."
msgid "Restructures the question meta data as it relates to quizzes - this accounts for changes in the data structure in v1.6+."
msgstr ""

#: classes/class-woothemes-sensei-updates.php:67
Expand Down Expand Up @@ -3077,14 +3077,6 @@ msgstr ""
msgid "This indexes the comment statuses in the database, which will speed up all Sensei activity queries."
msgstr ""

#: classes/class-woothemes-sensei-updates.php:82
msgid "Remove legacy Sensei activity types"
msgstr ""

#: classes/class-woothemes-sensei-updates.php:82
msgid "This removes all legacy (pre-1.7) Sensei activity types - only run this update once the update to v1.7 is complete and everything is stable."
msgstr ""

#: classes/class-woothemes-sensei-updates.php:106
#: classes/class-woothemes-sensei-updates.php:125
msgid "Sensei Updates"
Expand Down
Loading

0 comments on commit 5689f85

Please sign in to comment.