Class Sensei_Utils
Sensei Utilities Class
Common utility functions for Sensei.
public static
string
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
mixed
|
#
sensei_check_for_activity( array $args = array(), boolean $return_comments = false )
Check for Sensei activity. |
public static
array
|
|
public static
boolean
|
|
public static
boolean
|
|
public static
string
|
|
public static
boolean
|
#
sensei_customer_bought_product( string $customer_email, integer $user_id, integer $product_id )
Checks if a user (by email) has bought an item. |
public static
|
#
sensei_text_editor( string $content = '', string $editor_id = 'senseitexteditor', string $input_name = '' )
Load the WordPress rich text editor |
public static
boolean
|
#
sensei_save_quiz_answers( array $submitted = array(), integer $user_id = 0 )
Save quiz answers submitted by users |
public static
|
|
public static
integer
|
#
sensei_grade_quiz_auto( integer $quiz_id = 0, array $submitted = array(), integer $total_questions = 0, string $quiz_grade_type = 'auto' )
Grade quiz automatically |
public static
boolean
|
#
sensei_grade_quiz( integer $quiz_id = 0, integer $grade = 0, integer $user_id = 0, string $quiz_grade_type = 'auto' )
Grade quiz |
public static
integer
|
#
sensei_grade_question_auto( integer $question_id = 0, string $question_type = '', string $answer = '', integer $user_id = 0 )
Grade question automatically |
public static
boolean
|
#
sensei_grade_question( integer $question_id = 0, integer $grade = 0, integer $user_id = 0 )
Grade question |
public static
|
|
public static
mixed
|
#
user_start_lesson( integer $user_id = 0, integer $lesson_id = 0, boolean $complete = false )
Alias to Woothemes_Sensei_Utils::sensei_start_lesson |
public static
mixed
|
#
sensei_start_lesson( integer $lesson_id = 0, integer| $user_id = 0, boolean $complete = false )
Mark a lesson as started for user |
public static
boolean
|
#
sensei_remove_user_from_lesson( integer $lesson_id = 0, integer $user_id = 0, $from_course = false )
Remove user from lesson, deleting all data from the corresponding quiz |
public static
boolean
|
#
sensei_remove_user_from_course( integer $course_id = 0, integer $user_id = 0 )
Remove a user from a course, deleting all activities across all lessons |
public static
|
|
public static
|
|
public static
string
|
#
sensei_get_user_question_grade( mixed $question = 0, integer $user_id = 0 )
Returns the user_grade for a specific question and user, or sensei_user_answer entry |
public static
string
|
#
sensei_get_user_question_answer_notes( mixed $question = 0, integer $user_id = 0 )
Returns the answer_notes for a specific question and user, or sensei_user_answer entry |
public static
|
|
public static
|
|
public static
boolean
|
#
sensei_add_answer_notes( integer $question_id = 0, integer $user_id = 0, string $notes = '' )
Add answer notes to question |
public static
array
|
|
public static
|
|
public static
array
|
#
lesson_quiz_questions( integer $quiz_id = 0 )
This function returns an array of lesson quiz questions |
public static
integer
|
|
public static
integer
|
#
sensei_course_user_grade( integer $course_id = 0, integer $user_id = 0 )
Get user total grade for course |
public static
boolean
|
#
sensei_user_passed_course( integer $course_id = 0, integer $user_id = 0 )
Check if user has passed a course |
public static
|
#
sensei_user_course_status_message( integer $course_id = 0, integer $user_id = 0 )
Set the status message displayed to the user for a course |
public static
array
|
#
sensei_user_quiz_status_message( integer $lesson_id = 0, integer $user_id = 0, boolean $is_lesson = false )
Set the status message displayed to the user for a quiz |
public static
mixed
|
|
public static
mixed
|
#
user_started_course( integer $course_id = 0, integer $user_id = 0 )
Check if a user has started a course or not |
public static
integer
|
#
user_complete_course( integer $course_id = 0, integer $user_id = 0 )
Checks if a user has completed a course by checking every lesson status |
public static
boolean
|
#
user_completed_course( integer $course, integer $user_id = 0 )
Check if a user has completed a course or not |
public static
mixed
|
#
user_started_lesson( integer $lesson_id = 0, integer $user_id = 0 )
Check if a user has started a lesson or not |
public static
boolean
|
#
user_completed_lesson( mixed $lesson = 0, integer $user_id = 0 )
Check if a user has completed a lesson or not |
public static
object
|
#
user_course_status( integer $course_id = 0, integer $user_id = 0 )
Returns the requested course status |
public static
object
|
#
user_lesson_status( integer $lesson_id = 0, integer $user_id = 0 )
Returns the requested lesson status |
public static
|
|
public static
|
|
public static
mixed
|
#
update_lesson_status( integer|string $user_id, integer|string $lesson_id, string $status = 'in-progress', array $metadata = array() )
Sets the status for the lesson |
public static
mixed
|
#
update_course_status( integer $user_id, integer $course_id, string $status = 'in-progress', array $metadata = array() )
Sets the statuses for the Course |
public static
array
|
|
public static
array
|
#
comment_any_status_filter( array $pieces )
Allow retrieving comments with any comment_approved status, little bypass to WP_Comment. Required only for WP < 4.1 |
public static
array
|
#
comment_multiple_status_filter( array $pieces )
Allow retrieving comments within multiple statuses, little bypass to WP_Comment. Required only for WP < 4.1 |
public static
array
|
#
comment_total_sum_meta_value_filter( array $pieces )
Adjust the comment query to be faster on the database, used by Analysis admin |
public static
array
|
#
get_posts_count_only_filter( array $pieces )
Shifts counting of posts to the database where it should be. Likely not to be used due to knock on issues. |
public static
boolean
|
|
public static
boolean
|
#
update_user_data( string $data_key, integer $post_id, mixed $value = '' , integer $user_id = 0 )
add user specific data to the passed in sensei post type id |
public static
mixed
|
#
get_user_data( $data_key, $post_id, integer $user_id = 0 )
Get the user data stored on the passed in post type |
public static
boolean
|
#
delete_user_data( integer $data_key, integer $post_id, integer $user_id )
Delete the Sensei user data for the given key, Sensei post type and user combination. |
public static
string
|
#
generate_drop_down( string $selected_value, $options = array() , array $attributes = array(), boolean $enable_none_option = true )
The function creates a drop down. Never write up a Sensei select statement again. |
public static
float
|
|
public static
string
|
|
public static
|
|
public static
array
|
#
array_zip_merge( array $array_a, array $array_b )
Merge two arrays in a zip like fashion. If one array is longer than the other the elements will be apended to the end of the resulting array. |