@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | // Only show course & lesson excerpts in search results |
| 70 | 70 | add_filter( 'the_content', array( $this, 'sensei_search_results_excerpt' ) ); |
| 71 | 71 | |
| 72 | - //Use WooCommerce filter to show admin bar to Teachers. |
|
| 73 | - add_action( 'init', array( $this, 'sensei_show_admin_bar') ); |
|
| 72 | + //Use WooCommerce filter to show admin bar to Teachers. |
|
| 73 | + add_action( 'init', array( $this, 'sensei_show_admin_bar') ); |
|
| 74 | 74 | |
| 75 | - // Remove course from active courses if an order is cancelled or refunded |
|
| 75 | + // Remove course from active courses if an order is cancelled or refunded |
|
| 76 | 76 | add_action( 'woocommerce_order_status_processing_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 ); |
| 77 | 77 | add_action( 'woocommerce_order_status_completed_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 ); |
| 78 | 78 | add_action( 'woocommerce_order_status_on-hold_to_cancelled', array( $this, 'remove_active_course' ), 10, 1 ); |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | wp_enqueue_script( Sensei()->token . '-user-dashboard' ); |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - // Course Archive javascript |
|
| 137 | - if( is_post_type_archive( 'course' ) ){ |
|
| 136 | + // Course Archive javascript |
|
| 137 | + if( is_post_type_archive( 'course' ) ){ |
|
| 138 | 138 | |
| 139 | - wp_register_script( 'sensei-course-archive-js', esc_url( Sensei()->plugin_url . 'assets/js/frontend/course-archive' . $suffix . '.js' ), array( 'jquery' ), '1', true ); |
|
| 140 | - wp_enqueue_script( 'sensei-course-archive-js' ); |
|
| 139 | + wp_register_script( 'sensei-course-archive-js', esc_url( Sensei()->plugin_url . 'assets/js/frontend/course-archive' . $suffix . '.js' ), array( 'jquery' ), '1', true ); |
|
| 140 | + wp_enqueue_script( 'sensei-course-archive-js' ); |
|
| 141 | 141 | |
| 142 | - } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | // Allow additional scripts to be loaded |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | /** |
| 181 | 181 | * sensei_get_template_part function. |
| 182 | 182 | * |
| 183 | - * @deprecated sine 1.9.0 |
|
| 183 | + * @deprecated sine 1.9.0 |
|
| 184 | 184 | * @access public |
| 185 | 185 | * @param mixed $slug |
| 186 | 186 | * @param string $name (default: '') |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | function sensei_get_template_part( $slug, $name = '' ) { |
| 190 | 190 | |
| 191 | - _deprecated_function( 'class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part' ); |
|
| 192 | - Sensei_Templates::get_part( $slug, $name ); |
|
| 191 | + _deprecated_function( 'class-woothemes-sensei-frontend.php', '1.9.0', 'Sensei_Templates::get_part' ); |
|
| 192 | + Sensei_Templates::get_part( $slug, $name ); |
|
| 193 | 193 | |
| 194 | 194 | } // End sensei_get_template_part() |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * sensei_get_template function. |
| 198 | 198 | * |
| 199 | - * @deprecated since 1.9.0 |
|
| 199 | + * @deprecated since 1.9.0 |
|
| 200 | 200 | * @access public |
| 201 | 201 | * @param mixed $template_name |
| 202 | 202 | * @param array $args (default: array()) |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function sensei_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
| 208 | 208 | |
| 209 | - _deprecated_function( 'sensei_get_template', '1.9.0', 'Sensei_Templates::get_template' ); |
|
| 210 | - Sensei_Templates::get_template($template_name, $args, $template_path, $default_path ); |
|
| 209 | + _deprecated_function( 'sensei_get_template', '1.9.0', 'Sensei_Templates::get_template' ); |
|
| 210 | + Sensei_Templates::get_template($template_name, $args, $template_path, $default_path ); |
|
| 211 | 211 | |
| 212 | 212 | } // End sensei_get_template() |
| 213 | 213 | |
@@ -223,33 +223,33 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | function sensei_locate_template( $template_name, $template_path = '', $default_path = '' ) { |
| 225 | 225 | |
| 226 | - _deprecated_function( 'sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template' ); |
|
| 227 | - Sensei_Templates::locate_template( $template_name, $template_path, $default_path ); |
|
| 226 | + _deprecated_function( 'sensei_locate_template', '1.9.0', 'Sensei_Templates::locate_template' ); |
|
| 227 | + Sensei_Templates::locate_template( $template_name, $template_path, $default_path ); |
|
| 228 | 228 | |
| 229 | 229 | } // End sensei_locate_template() |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * sensei_output_content_wrapper function. |
| 234 | - * |
|
| 234 | + * |
|
| 235 | 235 | * @access public |
| 236 | 236 | * @return void |
| 237 | 237 | */ |
| 238 | 238 | function sensei_output_content_wrapper() { |
| 239 | 239 | |
| 240 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 241 | - $backwards_compatible_wrapper_location = array( |
|
| 242 | - Sensei()->template_url . 'wrappers/wrapper-start.php', |
|
| 243 | - 'wrappers/wrapper-start.php' |
|
| 244 | - ); |
|
| 240 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 241 | + $backwards_compatible_wrapper_location = array( |
|
| 242 | + Sensei()->template_url . 'wrappers/wrapper-start.php', |
|
| 243 | + 'wrappers/wrapper-start.php' |
|
| 244 | + ); |
|
| 245 | 245 | |
| 246 | - $template = locate_template( $backwards_compatible_wrapper_location ); |
|
| 247 | - if( !empty( $template ) ){ |
|
| 246 | + $template = locate_template( $backwards_compatible_wrapper_location ); |
|
| 247 | + if( !empty( $template ) ){ |
|
| 248 | 248 | |
| 249 | - Sensei_Templates::get_template( 'wrappers/wrapper-start.php' ); |
|
| 250 | - return; |
|
| 249 | + Sensei_Templates::get_template( 'wrappers/wrapper-start.php' ); |
|
| 250 | + return; |
|
| 251 | 251 | |
| 252 | - } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | 254 | Sensei_Templates::get_template( 'globals/wrapper-start.php' ); |
| 255 | 255 | |
@@ -258,25 +258,25 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * sensei_output_content_wrapper_end function. |
| 261 | - * |
|
| 261 | + * |
|
| 262 | 262 | * @access public |
| 263 | 263 | * @return void |
| 264 | 264 | */ |
| 265 | 265 | function sensei_output_content_wrapper_end() { |
| 266 | 266 | |
| 267 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 268 | - $backwards_compatible_wrapper_location = array( |
|
| 269 | - Sensei()->template_url . 'wrappers/wrapper-end.php', |
|
| 270 | - 'wrappers/wrapper-end.php' |
|
| 271 | - ); |
|
| 267 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 268 | + $backwards_compatible_wrapper_location = array( |
|
| 269 | + Sensei()->template_url . 'wrappers/wrapper-end.php', |
|
| 270 | + 'wrappers/wrapper-end.php' |
|
| 271 | + ); |
|
| 272 | 272 | |
| 273 | - $backwards_compatible_template = locate_template( $backwards_compatible_wrapper_location ); |
|
| 274 | - if( !empty( $backwards_compatible_template ) ){ |
|
| 273 | + $backwards_compatible_template = locate_template( $backwards_compatible_wrapper_location ); |
|
| 274 | + if( !empty( $backwards_compatible_template ) ){ |
|
| 275 | 275 | |
| 276 | - Sensei_Templates::get_template( 'wrappers/wrapper-end.php' ); |
|
| 277 | - return; |
|
| 276 | + Sensei_Templates::get_template( 'wrappers/wrapper-end.php' ); |
|
| 277 | + return; |
|
| 278 | 278 | |
| 279 | - } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | 281 | |
| 282 | 282 | Sensei_Templates::get_template( 'globals/wrapper-end.php' ); |
@@ -292,55 +292,55 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | public static function load_content_pagination() { |
| 294 | 294 | |
| 295 | - if( is_singular('course') ) { |
|
| 295 | + if( is_singular('course') ) { |
|
| 296 | 296 | |
| 297 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 298 | - $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-posts.php' ) ); |
|
| 299 | - if( !empty( $template ) ){ |
|
| 297 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 298 | + $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-posts.php' ) ); |
|
| 299 | + if( !empty( $template ) ){ |
|
| 300 | 300 | |
| 301 | - Sensei_Templates::get_template( 'wrappers/pagination-posts.php' ); |
|
| 302 | - return; |
|
| 301 | + Sensei_Templates::get_template( 'wrappers/pagination-posts.php' ); |
|
| 302 | + return; |
|
| 303 | 303 | |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | 306 | Sensei_Templates::get_template( 'globals/pagination-posts.php' ); |
| 307 | 307 | |
| 308 | 308 | } elseif( is_singular('lesson') ) { |
| 309 | 309 | |
| 310 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 311 | - $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-lesson.php' ) ); |
|
| 312 | - if( !empty( $template ) ){ |
|
| 310 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 311 | + $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-lesson.php' ) ); |
|
| 312 | + if( !empty( $template ) ){ |
|
| 313 | 313 | |
| 314 | - Sensei_Templates::get_template( 'wrappers/pagination-lesson.php' ); |
|
| 315 | - return; |
|
| 314 | + Sensei_Templates::get_template( 'wrappers/pagination-lesson.php' ); |
|
| 315 | + return; |
|
| 316 | 316 | |
| 317 | - } |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | 319 | Sensei_Templates::get_template( 'globals/pagination-lesson.php' ); |
| 320 | 320 | |
| 321 | 321 | } elseif( is_singular('quiz') ) { |
| 322 | 322 | |
| 323 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 324 | - $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-quiz.php' ) ); |
|
| 325 | - if( !empty( $template ) ){ |
|
| 323 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 324 | + $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination-quiz.php' ) ); |
|
| 325 | + if( !empty( $template ) ){ |
|
| 326 | 326 | |
| 327 | - Sensei_Templates::get_template( 'wrappers/pagination-quiz.php' ); |
|
| 328 | - return; |
|
| 327 | + Sensei_Templates::get_template( 'wrappers/pagination-quiz.php' ); |
|
| 328 | + return; |
|
| 329 | 329 | |
| 330 | - } |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | 332 | Sensei_Templates::get_template( 'globals/pagination-quiz.php' ); |
| 333 | 333 | |
| 334 | 334 | } else { |
| 335 | 335 | |
| 336 | - // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 337 | - $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination.php' ) ); |
|
| 338 | - if( !empty( $template ) ){ |
|
| 336 | + // backwards compatibility check for old location under the wrappers directory of the active theme |
|
| 337 | + $template = locate_template( array( Sensei()->template_url . 'wrappers/pagination.php' ) ); |
|
| 338 | + if( !empty( $template ) ){ |
|
| 339 | 339 | |
| 340 | - Sensei_Templates::get_template( 'wrappers/pagination.php' ); |
|
| 341 | - return; |
|
| 340 | + Sensei_Templates::get_template( 'wrappers/pagination.php' ); |
|
| 341 | + return; |
|
| 342 | 342 | |
| 343 | - } |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | 345 | Sensei_Templates::get_template( 'globals/pagination.php' ); |
| 346 | 346 | |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | case '#senseimymessages': |
| 399 | 399 | $item->url = $my_messages_url; |
| 400 | - // if no archive link exist for sensei_message |
|
| 401 | - // set it back to the place holder |
|
| 402 | - if( ! $item->url ){ |
|
| 400 | + // if no archive link exist for sensei_message |
|
| 401 | + // set it back to the place holder |
|
| 402 | + if( ! $item->url ){ |
|
| 403 | 403 | |
| 404 | - $item->url = '#senseimymessages'; |
|
| 404 | + $item->url = '#senseimymessages'; |
|
| 405 | 405 | |
| 406 | - } |
|
| 406 | + } |
|
| 407 | 407 | break; |
| 408 | 408 | |
| 409 | 409 | case '#senseilearnerprofile': |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | // Remove the My Messages link for logged out users or if Private Messages are disabled |
| 471 | 471 | if( ! get_post_type_archive_link( 'sensei_message' ) |
| 472 | - && '#senseimymessages' == $item->url ) { |
|
| 472 | + && '#senseimymessages' == $item->url ) { |
|
| 473 | 473 | |
| 474 | 474 | if ( !is_user_logged_in() || ( isset( Sensei()->settings->settings['messages_disable'] ) && Sensei()->settings->settings['messages_disable'] ) ) { |
| 475 | 475 | |
@@ -492,42 +492,42 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | // add category nicenames in body and post class |
| 494 | 494 | function sensei_search_results_classes($classes) { |
| 495 | - global $post; |
|
| 496 | - // Handle Search Classes for Courses, Lessons, and WC Products |
|
| 497 | - if ( isset( $post->post_type ) && ( ( 'course' == $post->post_type ) || ( 'lesson' == $post->post_type ) || ( 'product' == $post->post_type ) ) ) { |
|
| 498 | - $classes[] = 'post'; |
|
| 495 | + global $post; |
|
| 496 | + // Handle Search Classes for Courses, Lessons, and WC Products |
|
| 497 | + if ( isset( $post->post_type ) && ( ( 'course' == $post->post_type ) || ( 'lesson' == $post->post_type ) || ( 'product' == $post->post_type ) ) ) { |
|
| 498 | + $classes[] = 'post'; |
|
| 499 | 499 | } // End If Statement |
| 500 | - return $classes; |
|
| 500 | + return $classes; |
|
| 501 | 501 | } // End sensei_search_results_classes() |
| 502 | 502 | |
| 503 | - /** |
|
| 504 | - * sensei_single_title output for single page title |
|
| 505 | - * @since 1.1.0 |
|
| 506 | - * @return void |
|
| 507 | - * @deprecated |
|
| 508 | - */ |
|
| 509 | - function the_single_title() { |
|
| 503 | + /** |
|
| 504 | + * sensei_single_title output for single page title |
|
| 505 | + * @since 1.1.0 |
|
| 506 | + * @return void |
|
| 507 | + * @deprecated |
|
| 508 | + */ |
|
| 509 | + function the_single_title() { |
|
| 510 | 510 | |
| 511 | - _deprecated_function(' WooThemes_Sensei_Frontend::the_single_title', '1.9.0'); |
|
| 511 | + _deprecated_function(' WooThemes_Sensei_Frontend::the_single_title', '1.9.0'); |
|
| 512 | 512 | |
| 513 | - } // End sensei_single_title() |
|
| 513 | + } // End sensei_single_title() |
|
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | 516 | * sensei_course_image output for course image Please use Sensei()->course->course_image instead. |
| 517 | - * |
|
| 518 | - * @deprecated since 1.9.0 |
|
| 519 | - * @param $course_id |
|
| 520 | - * @param string $width |
|
| 521 | - * @param string $height |
|
| 522 | - * @param bool|false $return |
|
| 523 | - * @return string|void |
|
| 517 | + * |
|
| 518 | + * @deprecated since 1.9.0 |
|
| 519 | + * @param $course_id |
|
| 520 | + * @param string $width |
|
| 521 | + * @param string $height |
|
| 522 | + * @param bool|false $return |
|
| 523 | + * @return string|void |
|
| 524 | 524 | */ |
| 525 | 525 | function sensei_course_image( $course_id, $width = '100', $height = '100', $return = false ) { |
| 526 | 526 | |
| 527 | - if ( ! $return ) { |
|
| 527 | + if ( ! $return ) { |
|
| 528 | 528 | |
| 529 | 529 | echo Sensei()->course->course_image( $course_id, $width, $height ); |
| 530 | - return ''; |
|
| 530 | + return ''; |
|
| 531 | 531 | |
| 532 | 532 | } // End If Statement |
| 533 | 533 | |
@@ -538,31 +538,31 @@ discard block |
||
| 538 | 538 | /** |
| 539 | 539 | * sensei_lesson_image output for lesson image |
| 540 | 540 | * @since 1.2.0 |
| 541 | - * @deprecated since 1.9.0 |
|
| 542 | - * @param $lesson_id |
|
| 543 | - * @param string $width |
|
| 544 | - * @param string $height |
|
| 545 | - * @param bool|false $return |
|
| 546 | - * @param bool|false $widget |
|
| 547 | - * @return string |
|
| 541 | + * @deprecated since 1.9.0 |
|
| 542 | + * @param $lesson_id |
|
| 543 | + * @param string $width |
|
| 544 | + * @param string $height |
|
| 545 | + * @param bool|false $return |
|
| 546 | + * @param bool|false $widget |
|
| 547 | + * @return string |
|
| 548 | 548 | */ |
| 549 | 549 | function sensei_lesson_image( $lesson_id, $width = '100', $height = '100', $return = false, $widget = false ) { |
| 550 | 550 | |
| 551 | - if( ! $return ){ |
|
| 551 | + if( ! $return ){ |
|
| 552 | 552 | |
| 553 | - echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
|
| 554 | - return ''; |
|
| 555 | - } |
|
| 553 | + echo Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
|
| 554 | + return ''; |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | - return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
|
| 557 | + return Sensei()->lesson->lesson_image( $lesson_id, $width, $height, $widget ); |
|
| 558 | 558 | |
| 559 | 559 | } // End sensei_lesson_image() |
| 560 | 560 | |
| 561 | - /** |
|
| 562 | - * @since 1.0.0 |
|
| 563 | - * @param WP_Query $query |
|
| 564 | - */ |
|
| 565 | - function sensei_course_archive_pagination( $query ) { |
|
| 561 | + /** |
|
| 562 | + * @since 1.0.0 |
|
| 563 | + * @param WP_Query $query |
|
| 564 | + */ |
|
| 565 | + function sensei_course_archive_pagination( $query ) { |
|
| 566 | 566 | |
| 567 | 567 | if( ! is_admin() && $query->is_main_query() && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'newcourses', 'featuredcourses', 'freecourses', 'paidcourses' ) ) ) { |
| 568 | 568 | |
@@ -585,50 +585,50 @@ discard block |
||
| 585 | 585 | * |
| 586 | 586 | * @access public |
| 587 | 587 | * @since 1.2.0 |
| 588 | - * @deprecated since 1.9.0 use WooThemes_Sensei_Course::archive_header |
|
| 588 | + * @deprecated since 1.9.0 use WooThemes_Sensei_Course::archive_header |
|
| 589 | 589 | * @return void |
| 590 | 590 | */ |
| 591 | 591 | function sensei_course_archive_header( ) { |
| 592 | 592 | |
| 593 | - trigger_error('This function sensei_course_archive_header has been depricated. Please use: WooThemes_Sensei_Course::course_archive_header '); |
|
| 594 | - WooThemes_Sensei_Course::archive_header( '', '<header class="archive-header"><h1>', '</h1></header>' ); |
|
| 593 | + trigger_error('This function sensei_course_archive_header has been depricated. Please use: WooThemes_Sensei_Course::course_archive_header '); |
|
| 594 | + WooThemes_Sensei_Course::archive_header( '', '<header class="archive-header"><h1>', '</h1></header>' ); |
|
| 595 | 595 | |
| 596 | 596 | } // sensei_course_archive_header() |
| 597 | 597 | |
| 598 | 598 | /** |
| 599 | 599 | * sensei_lesson_archive_header function. |
| 600 | 600 | * |
| 601 | - * @deprecated since 1.9.0 |
|
| 601 | + * @deprecated since 1.9.0 |
|
| 602 | 602 | * @access public |
| 603 | 603 | * @since 1.2.1 |
| 604 | 604 | * @return void |
| 605 | 605 | */ |
| 606 | 606 | public function sensei_lesson_archive_header( ) { |
| 607 | - _deprecated_function( 'WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header' ); |
|
| 608 | - Sensei()->lesson->the_archive_header(); |
|
| 607 | + _deprecated_function( 'WooThemes_Sensei_Frontend::sensei_lesson_archive_header', '1.9.0', 'WooThemes_Sensei_Lesson::the_archive_header' ); |
|
| 608 | + Sensei()->lesson->the_archive_header(); |
|
| 609 | 609 | } // sensei_course_archive_header() |
| 610 | 610 | |
| 611 | - /** |
|
| 612 | - * @deprecated since 1.9.0 |
|
| 613 | - */ |
|
| 611 | + /** |
|
| 612 | + * @deprecated since 1.9.0 |
|
| 613 | + */ |
|
| 614 | 614 | public function sensei_message_archive_header( ){ |
| 615 | - _deprecated_function('Sensei_Frontend::sensei_message_archive_header','Please use: Sense'); |
|
| 616 | - Sensei_Messages::the_archive_header(); |
|
| 615 | + _deprecated_function('Sensei_Frontend::sensei_message_archive_header','Please use: Sense'); |
|
| 616 | + Sensei_Messages::the_archive_header(); |
|
| 617 | 617 | } // sensei_message_archive_header() |
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * sensei_course_archive_course_title output for course archive page individual course title |
| 621 | 621 | * @since 1.2.0 |
| 622 | - * @param WP_Post $post_item |
|
| 622 | + * @param WP_Post $post_item |
|
| 623 | 623 | * @return void |
| 624 | 624 | */ |
| 625 | 625 | function sensei_course_archive_course_title( $post_item ) { |
| 626 | 626 | if ( isset( $post_item->ID ) && ( 0 < $post_item->ID ) ) { |
| 627 | 627 | $post_id = absint( $post_item->ID ); |
| 628 | - $post_title = $post_item->post_title; |
|
| 628 | + $post_title = $post_item->post_title; |
|
| 629 | 629 | } else { |
| 630 | 630 | $post_id = get_the_ID(); |
| 631 | - $post_title = get_the_title(); |
|
| 631 | + $post_title = get_the_title(); |
|
| 632 | 632 | } // End If Statement |
| 633 | 633 | ?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php |
| 634 | 634 | } // End sensei_course_archive_course_title() |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | public function sensei_lesson_archive_lesson_title() { |
| 642 | 642 | $post_id = get_the_ID(); |
| 643 | - $post_title = get_the_title(); |
|
| 643 | + $post_title = get_the_title(); |
|
| 644 | 644 | ?><header><h2><a href="<?php echo get_permalink( $post_id ); ?>" title="<?php echo esc_attr( $post_title ); ?>"><?php echo $post_title; ?></a></h2></header><?php |
| 645 | 645 | } // End sensei_lesson_archive_lesson_title() |
| 646 | 646 | |
@@ -657,9 +657,9 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | if( empty( $id ) ){ |
| 659 | 659 | |
| 660 | - $id = get_the_ID(); |
|
| 660 | + $id = get_the_ID(); |
|
| 661 | 661 | |
| 662 | - } |
|
| 662 | + } |
|
| 663 | 663 | |
| 664 | 664 | $sensei_breadcrumb_prefix = __( 'Back to: ', 'woothemes-sensei' ); |
| 665 | 665 | $separator = apply_filters( 'sensei_breadcrumb_separator', '>' ); |
@@ -672,31 +672,31 @@ discard block |
||
| 672 | 672 | return; |
| 673 | 673 | } |
| 674 | 674 | $html .= '<a href="' . esc_url( get_permalink( $course_id ) ) . '" title="' . __( 'Back to the course', 'woothemes-sensei' ) . '">' . get_the_title( $course_id ) . '</a>'; |
| 675 | - } // End If Statement |
|
| 676 | - // Quiz |
|
| 675 | + } // End If Statement |
|
| 676 | + // Quiz |
|
| 677 | 677 | if ( is_singular( 'quiz' ) && 0 < intval( $id ) ) { |
| 678 | 678 | $lesson_id = intval( get_post_meta( $id, '_quiz_lesson', true ) ); |
| 679 | 679 | if( ! $lesson_id ) { |
| 680 | 680 | return; |
| 681 | 681 | } |
| 682 | 682 | $html .= '<a href="' . esc_url( get_permalink( $lesson_id ) ) . '" title="' . __( 'Back to the lesson', 'woothemes-sensei' ) . '">' . get_the_title( $lesson_id ) . '</a>'; |
| 683 | - } // End If Statement |
|
| 683 | + } // End If Statement |
|
| 684 | 684 | |
| 685 | - // Allow other plugins to filter html |
|
| 686 | - $html = apply_filters ( 'sensei_breadcrumb_output', $html, $separator ); |
|
| 687 | - $html .= '</section>'; |
|
| 685 | + // Allow other plugins to filter html |
|
| 686 | + $html = apply_filters ( 'sensei_breadcrumb_output', $html, $separator ); |
|
| 687 | + $html .= '</section>'; |
|
| 688 | 688 | |
| 689 | - echo $html; |
|
| 689 | + echo $html; |
|
| 690 | 690 | } // End sensei_breadcrumb() |
| 691 | 691 | |
| 692 | 692 | |
| 693 | - /** |
|
| 694 | - * @deprecated since 1.9.0 use WooThemes_Sensei_Lesson::course_signup_link instead |
|
| 695 | - */ |
|
| 693 | + /** |
|
| 694 | + * @deprecated since 1.9.0 use WooThemes_Sensei_Lesson::course_signup_link instead |
|
| 695 | + */ |
|
| 696 | 696 | public function sensei_lesson_course_signup_link( ) { |
| 697 | 697 | |
| 698 | - _deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link' ); |
|
| 699 | - WooThemes_Sensei_Lesson::course_signup_link(); |
|
| 698 | + _deprecated_function('sensei_lesson_course_signup_link', '1.9.0', 'WooThemes_Sensei_Lesson::course_signup_link' ); |
|
| 699 | + WooThemes_Sensei_Lesson::course_signup_link(); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | public function lesson_tags_display( $lesson_id = 0 ) { |
@@ -715,27 +715,27 @@ discard block |
||
| 715 | 715 | ?><section class="lesson-tags"> |
| 716 | 716 | <?php printf( __( 'Lesson tags: %1$s', 'woothemes-sensei' ), $tag_list ); ?> |
| 717 | 717 | </section><?php |
| 718 | - } |
|
| 719 | - } |
|
| 718 | + } |
|
| 719 | + } |
|
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - /** |
|
| 724 | - * @param WP_Query $query |
|
| 725 | - */ |
|
| 723 | + /** |
|
| 724 | + * @param WP_Query $query |
|
| 725 | + */ |
|
| 726 | 726 | public function lesson_tag_archive_filter( $query ) { |
| 727 | - if( is_tax( 'lesson-tag' ) && $query->is_main_query() ) { |
|
| 728 | - // Limit to lessons only |
|
| 729 | - $query->set( 'post_type', 'lesson' ); |
|
| 727 | + if( is_tax( 'lesson-tag' ) && $query->is_main_query() ) { |
|
| 728 | + // Limit to lessons only |
|
| 729 | + $query->set( 'post_type', 'lesson' ); |
|
| 730 | 730 | |
| 731 | - // Set order of lessons |
|
| 732 | - $query->set( 'orderby', 'menu_order' ); |
|
| 733 | - $query->set( 'order', 'ASC' ); |
|
| 731 | + // Set order of lessons |
|
| 732 | + $query->set( 'orderby', 'menu_order' ); |
|
| 733 | + $query->set( 'order', 'ASC' ); |
|
| 734 | 734 | |
| 735 | - } |
|
| 736 | - } |
|
| 735 | + } |
|
| 736 | + } |
|
| 737 | 737 | |
| 738 | - public function lesson_tag_archive_header( $title ) { |
|
| 738 | + public function lesson_tag_archive_header( $title ) { |
|
| 739 | 739 | if( is_tax( 'lesson-tag' ) ) { |
| 740 | 740 | $title = sprintf( __( 'Lesson tag: %1$s', 'woothemes-sensei' ), apply_filters( 'sensei_lesson_tag_archive_title', get_queried_object()->name ) ); |
| 741 | 741 | } |
@@ -757,13 +757,13 @@ discard block |
||
| 757 | 757 | $sanitized_submit = esc_html( $_POST['quiz_action'] ); |
| 758 | 758 | |
| 759 | 759 | switch ($sanitized_submit) { |
| 760 | - case 'lesson-complete': |
|
| 760 | + case 'lesson-complete': |
|
| 761 | 761 | |
| 762 | 762 | Sensei_Utils::sensei_start_lesson( $post->ID, $current_user->ID, $complete = true ); |
| 763 | 763 | |
| 764 | 764 | break; |
| 765 | 765 | |
| 766 | - case 'lesson-reset': |
|
| 766 | + case 'lesson-reset': |
|
| 767 | 767 | |
| 768 | 768 | Sensei_Utils::sensei_remove_user_from_lesson( $post->ID, $current_user->ID ); |
| 769 | 769 | |
@@ -875,13 +875,13 @@ discard block |
||
| 875 | 875 | if ( 0 < intval( $post_id ) ) { |
| 876 | 876 | $lesson_video_embed = get_post_meta( $post_id, '_lesson_video_embed', true ); |
| 877 | 877 | if ( 'http' == substr( $lesson_video_embed, 0, 4) ) { |
| 878 | - // V2 - make width and height a setting for video embed |
|
| 879 | - $lesson_video_embed = wp_oembed_get( esc_url( $lesson_video_embed )/*, array( 'width' => 100 , 'height' => 100)*/ ); |
|
| 880 | - } // End If Statement |
|
| 881 | - if ( '' != $lesson_video_embed ) { |
|
| 882 | - ?><div class="video"><?php echo html_entity_decode($lesson_video_embed); ?></div><?php |
|
| 883 | - } // End If Statement |
|
| 884 | - } // End If Statement |
|
| 878 | + // V2 - make width and height a setting for video embed |
|
| 879 | + $lesson_video_embed = wp_oembed_get( esc_url( $lesson_video_embed )/*, array( 'width' => 100 , 'height' => 100)*/ ); |
|
| 880 | + } // End If Statement |
|
| 881 | + if ( '' != $lesson_video_embed ) { |
|
| 882 | + ?><div class="video"><?php echo html_entity_decode($lesson_video_embed); ?></div><?php |
|
| 883 | + } // End If Statement |
|
| 884 | + } // End If Statement |
|
| 885 | 885 | } // End sensei_lesson_video() |
| 886 | 886 | |
| 887 | 887 | public function sensei_complete_lesson_button() { |
@@ -894,8 +894,8 @@ discard block |
||
| 894 | 894 | $pass_required = true; |
| 895 | 895 | if( $quiz_id ) { |
| 896 | 896 | // Get quiz pass setting |
| 897 | - $pass_required = get_post_meta( $quiz_id, '_pass_required', true ); |
|
| 898 | - } |
|
| 897 | + $pass_required = get_post_meta( $quiz_id, '_pass_required', true ); |
|
| 898 | + } |
|
| 899 | 899 | if( ! $quiz_id || ( $quiz_id && ! $pass_required ) ) { |
| 900 | 900 | ?> |
| 901 | 901 | <form class="lesson_button_form" method="POST" action="<?php echo esc_url( get_permalink() ); ?>"> |
@@ -948,12 +948,12 @@ discard block |
||
| 948 | 948 | } // End If Statement |
| 949 | 949 | } // End sensei_reset_lesson_button() |
| 950 | 950 | |
| 951 | - /** |
|
| 952 | - * @deprecated since 1.9.0 |
|
| 953 | - */ |
|
| 954 | - public function sensei_lesson_quiz_meta( ) { |
|
| 951 | + /** |
|
| 952 | + * @deprecated since 1.9.0 |
|
| 953 | + */ |
|
| 954 | + public function sensei_lesson_quiz_meta( ) { |
|
| 955 | 955 | |
| 956 | - Sensei_Lesson::footer_quiz_call_to_action(); |
|
| 956 | + Sensei_Lesson::footer_quiz_call_to_action(); |
|
| 957 | 957 | |
| 958 | 958 | } // End sensei_lesson_quiz_meta() |
| 959 | 959 | |
@@ -979,38 +979,38 @@ discard block |
||
| 979 | 979 | </p> |
| 980 | 980 | <p class="course-excerpt"><?php the_excerpt(); ?></p> |
| 981 | 981 | <?php if ( 0 < $free_lesson_count ) { |
| 982 | - $free_lessons = sprintf( __( 'You can access %d of this course\'s lessons for free', 'woothemes-sensei' ), $free_lesson_count ); ?> |
|
| 982 | + $free_lessons = sprintf( __( 'You can access %d of this course\'s lessons for free', 'woothemes-sensei' ), $free_lesson_count ); ?> |
|
| 983 | 983 | <p class="sensei-free-lessons"><a href="<?php echo get_permalink( $post_id ); ?>"><?php _e( 'Preview this course', 'woothemes-sensei' ) ?></a> - <?php echo $free_lessons; ?></p> |
| 984 | 984 | <?php } ?> |
| 985 | 985 | </section><?php |
| 986 | 986 | } // End sensei_course_archive_meta() |
| 987 | 987 | |
| 988 | - /** |
|
| 989 | - * @deprecated since 1.9.0 |
|
| 990 | - */ |
|
| 988 | + /** |
|
| 989 | + * @deprecated since 1.9.0 |
|
| 990 | + */ |
|
| 991 | 991 | public function sensei_single_main_content() { |
| 992 | - _deprecated_function('Woothemes_Sensei_Frontend::sensei_single_main_content', '1.9.0'); |
|
| 992 | + _deprecated_function('Woothemes_Sensei_Frontend::sensei_single_main_content', '1.9.0'); |
|
| 993 | 993 | } // End sensei_single_main_content() |
| 994 | 994 | |
| 995 | - /** |
|
| 996 | - * @deprecated since 1.9.0 |
|
| 997 | - */ |
|
| 995 | + /** |
|
| 996 | + * @deprecated since 1.9.0 |
|
| 997 | + */ |
|
| 998 | 998 | public function sensei_lesson_archive_main_content() { |
| 999 | - _deprecated_function('Sensei_Frontend::sensei_lesson_archive_main_content', '1.9.0', 'Please include loop-lesson.php directly'); |
|
| 999 | + _deprecated_function('Sensei_Frontend::sensei_lesson_archive_main_content', '1.9.0', 'Please include loop-lesson.php directly'); |
|
| 1000 | 1000 | } // End sensei_lesson_archive_main_content() |
| 1001 | 1001 | |
| 1002 | - /** |
|
| 1003 | - * @deprecated since 1.9.0 |
|
| 1004 | - */ |
|
| 1002 | + /** |
|
| 1003 | + * @deprecated since 1.9.0 |
|
| 1004 | + */ |
|
| 1005 | 1005 | public function sensei_message_archive_main_content() { |
| 1006 | 1006 | _deprecated_function( 'Sensei_Frontend::sensei_message_archive_main_content', 'This method is no longer needed' ); |
| 1007 | 1007 | } // End sensei_lesson_archive_main_content() |
| 1008 | 1008 | |
| 1009 | - /** |
|
| 1010 | - * @deprecated since 1.9.0 |
|
| 1011 | - */ |
|
| 1009 | + /** |
|
| 1010 | + * @deprecated since 1.9.0 |
|
| 1011 | + */ |
|
| 1012 | 1012 | public function sensei_no_permissions_main_content() { |
| 1013 | - _deprecated_function( 'Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed' ); |
|
| 1013 | + _deprecated_function( 'Sensei_Frontend::sensei_no_permissions_main_content', 'This method is no longer needed' ); |
|
| 1014 | 1014 | } // End sensei_no_permissions_main_content() |
| 1015 | 1015 | |
| 1016 | 1016 | public function sensei_course_category_main_content() { |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | <div class="col-1"> |
| 1059 | 1059 | <?php |
| 1060 | 1060 | // output the actual form markup |
| 1061 | - Sensei_Templates::get_template( 'user/login-form.php'); |
|
| 1061 | + Sensei_Templates::get_template( 'user/login-form.php'); |
|
| 1062 | 1062 | ?> |
| 1063 | 1063 | </div> |
| 1064 | 1064 | |
@@ -1139,12 +1139,12 @@ discard block |
||
| 1139 | 1139 | |
| 1140 | 1140 | //if this is a paid course |
| 1141 | 1141 | if ( Sensei_WC::is_woocommerce_active() ) { |
| 1142 | - $wc_post_id = get_post_meta( $course_id, '_course_woocommerce_product', true ); |
|
| 1143 | - if ( 0 < $wc_post_id ) { |
|
| 1144 | - $preview_text = __( ' (Free Preview)', 'woothemes-sensei' ); |
|
| 1145 | - } // End If Statement |
|
| 1146 | - } |
|
| 1147 | - return $preview_text; |
|
| 1142 | + $wc_post_id = get_post_meta( $course_id, '_course_woocommerce_product', true ); |
|
| 1143 | + if ( 0 < $wc_post_id ) { |
|
| 1144 | + $preview_text = __( ' (Free Preview)', 'woothemes-sensei' ); |
|
| 1145 | + } // End If Statement |
|
| 1146 | + } |
|
| 1147 | + return $preview_text; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | public function sensei_lesson_preview_title( $title = '', $id = 0 ) { |
@@ -1176,8 +1176,8 @@ discard block |
||
| 1176 | 1176 | $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
| 1177 | 1177 | // Handle user starting the course |
| 1178 | 1178 | if ( isset( $_POST['course_start'] ) |
| 1179 | - && wp_verify_nonce( $_POST[ 'woothemes_sensei_start_course_noonce' ], 'woothemes_sensei_start_course_noonce' ) |
|
| 1180 | - && !$is_user_taking_course ) { |
|
| 1179 | + && wp_verify_nonce( $_POST[ 'woothemes_sensei_start_course_noonce' ], 'woothemes_sensei_start_course_noonce' ) |
|
| 1180 | + && !$is_user_taking_course ) { |
|
| 1181 | 1181 | |
| 1182 | 1182 | // Start the course |
| 1183 | 1183 | $activity_logged = Sensei_Utils::user_start_course( $current_user->ID, $post->ID ); |
@@ -1196,35 +1196,35 @@ discard block |
||
| 1196 | 1196 | } // End If Statement |
| 1197 | 1197 | } // End sensei_course_start() |
| 1198 | 1198 | |
| 1199 | - /** |
|
| 1200 | - * @deprecated since 1.9.0 |
|
| 1201 | - */ |
|
| 1199 | + /** |
|
| 1200 | + * @deprecated since 1.9.0 |
|
| 1201 | + */ |
|
| 1202 | 1202 | public function sensei_course_meta() { |
| 1203 | - _deprecated_function( 'Sensei_Frontend::sensei_course_meta', '1.9.0' , 'Sensei_Course::the_course_meta()' ); |
|
| 1204 | - Sensei()->course->the_course_meta( get_post() ); |
|
| 1203 | + _deprecated_function( 'Sensei_Frontend::sensei_course_meta', '1.9.0' , 'Sensei_Course::the_course_meta()' ); |
|
| 1204 | + Sensei()->course->the_course_meta( get_post() ); |
|
| 1205 | 1205 | } // End sensei_course_meta() |
| 1206 | 1206 | |
| 1207 | - /** |
|
| 1208 | - * @deprecated since 1.9.0 |
|
| 1209 | - */ |
|
| 1207 | + /** |
|
| 1208 | + * @deprecated since 1.9.0 |
|
| 1209 | + */ |
|
| 1210 | 1210 | public function sensei_course_meta_video() { |
| 1211 | - _deprecated_function( 'Sensei_Frontend::sensei_course_meta_video', '1.9.0' , 'Sensei_Course::the_course_video()' ); |
|
| 1212 | - Sensei_Course::the_course_video(); |
|
| 1211 | + _deprecated_function( 'Sensei_Frontend::sensei_course_meta_video', '1.9.0' , 'Sensei_Course::the_course_video()' ); |
|
| 1212 | + Sensei_Course::the_course_video(); |
|
| 1213 | 1213 | } // End sensei_course_meta_video() |
| 1214 | 1214 | |
| 1215 | - /** |
|
| 1216 | - * This function shows the WooCommerce cart notice if the user has |
|
| 1217 | - * added the current course to cart. It does not show if the user is already taking |
|
| 1218 | - * the course. |
|
| 1219 | - * |
|
| 1220 | - * @since 1.0.2 |
|
| 1221 | - * @return void; |
|
| 1222 | - */ |
|
| 1223 | - public function sensei_woocommerce_in_cart_message() { |
|
| 1215 | + /** |
|
| 1216 | + * This function shows the WooCommerce cart notice if the user has |
|
| 1217 | + * added the current course to cart. It does not show if the user is already taking |
|
| 1218 | + * the course. |
|
| 1219 | + * |
|
| 1220 | + * @since 1.0.2 |
|
| 1221 | + * @return void; |
|
| 1222 | + */ |
|
| 1223 | + public function sensei_woocommerce_in_cart_message() { |
|
| 1224 | 1224 | global $post, $woocommerce; |
| 1225 | 1225 | |
| 1226 | 1226 | $wc_post_id = absint( get_post_meta( $post->ID, '_course_woocommerce_product', true ) ); |
| 1227 | - $user_course_status_id = Sensei_Utils::user_started_course($post->ID , get_current_user_id() ); |
|
| 1227 | + $user_course_status_id = Sensei_Utils::user_started_course($post->ID , get_current_user_id() ); |
|
| 1228 | 1228 | if ( 0 < intval( $wc_post_id ) && ! $user_course_status_id ) { |
| 1229 | 1229 | |
| 1230 | 1230 | if ( Sensei_WC::is_product_in_cart( $wc_post_id ) ) { |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | $item_id = $item['product_id']; |
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | - if ( $item_id > 0 ) { |
|
| 1275 | + if ( $item_id > 0 ) { |
|
| 1276 | 1276 | |
| 1277 | 1277 | $user_id = get_post_meta( $order_id, '_customer_user', true ); |
| 1278 | 1278 | |
@@ -1352,15 +1352,15 @@ discard block |
||
| 1352 | 1352 | |
| 1353 | 1353 | $items = $order->get_items(); |
| 1354 | 1354 | foreach( $items as $item ) { |
| 1355 | - if (isset($item['variation_id']) && $item['variation_id'] > 0) { |
|
| 1356 | - $item_id = $item['variation_id']; |
|
| 1357 | - $product_type = 'variation'; |
|
| 1358 | - } else { |
|
| 1359 | - $item_id = $item['product_id']; |
|
| 1360 | - } |
|
| 1355 | + if (isset($item['variation_id']) && $item['variation_id'] > 0) { |
|
| 1356 | + $item_id = $item['variation_id']; |
|
| 1357 | + $product_type = 'variation'; |
|
| 1358 | + } else { |
|
| 1359 | + $item_id = $item['product_id']; |
|
| 1360 | + } |
|
| 1361 | 1361 | |
| 1362 | - $product_ids[] = $item_id; |
|
| 1363 | - } |
|
| 1362 | + $product_ids[] = $item_id; |
|
| 1363 | + } |
|
| 1364 | 1364 | |
| 1365 | 1365 | $order_ids[] = $post_id; |
| 1366 | 1366 | } |
@@ -1468,32 +1468,32 @@ discard block |
||
| 1468 | 1468 | $items = $order->get_items(); |
| 1469 | 1469 | foreach( $items as $item ) { |
| 1470 | 1470 | |
| 1471 | - $product = wc_get_product( $item['product_id'] ); |
|
| 1471 | + $product = wc_get_product( $item['product_id'] ); |
|
| 1472 | 1472 | |
| 1473 | - // handle product bundles |
|
| 1474 | - if( is_object( $product ) && $product->is_type('bundle') ){ |
|
| 1473 | + // handle product bundles |
|
| 1474 | + if( is_object( $product ) && $product->is_type('bundle') ){ |
|
| 1475 | 1475 | |
| 1476 | - $bundled_product = new WC_Product_Bundle( $product->id ); |
|
| 1477 | - $bundled_items = $bundled_product->get_bundled_items(); |
|
| 1476 | + $bundled_product = new WC_Product_Bundle( $product->id ); |
|
| 1477 | + $bundled_items = $bundled_product->get_bundled_items(); |
|
| 1478 | 1478 | |
| 1479 | - foreach( $bundled_items as $bundled_item ){ |
|
| 1479 | + foreach( $bundled_items as $bundled_item ){ |
|
| 1480 | 1480 | |
| 1481 | - if( $bundled_item->product_id == $course_product_id ) { |
|
| 1482 | - Sensei_Utils::user_start_course( $user_id, $course_id ); |
|
| 1483 | - return; |
|
| 1484 | - } |
|
| 1481 | + if( $bundled_item->product_id == $course_product_id ) { |
|
| 1482 | + Sensei_Utils::user_start_course( $user_id, $course_id ); |
|
| 1483 | + return; |
|
| 1484 | + } |
|
| 1485 | 1485 | |
| 1486 | - } |
|
| 1486 | + } |
|
| 1487 | 1487 | |
| 1488 | - } else { |
|
| 1488 | + } else { |
|
| 1489 | 1489 | |
| 1490 | - // handle regular products |
|
| 1491 | - if( $item['product_id'] == $course_product_id ) { |
|
| 1492 | - Sensei_Utils::user_start_course( $user_id, $course_id ); |
|
| 1493 | - return; |
|
| 1494 | - } |
|
| 1490 | + // handle regular products |
|
| 1491 | + if( $item['product_id'] == $course_product_id ) { |
|
| 1492 | + Sensei_Utils::user_start_course( $user_id, $course_id ); |
|
| 1493 | + return; |
|
| 1494 | + } |
|
| 1495 | 1495 | |
| 1496 | - } |
|
| 1496 | + } |
|
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | 1499 | |
@@ -1524,21 +1524,21 @@ discard block |
||
| 1524 | 1524 | |
| 1525 | 1525 | //if not posted from the sensei login form let |
| 1526 | 1526 | // WordPress or any other party handle the failed request |
| 1527 | - if( ! isset( $_REQUEST['form'] ) || 'sensei-login' != $_REQUEST['form'] ){ |
|
| 1527 | + if( ! isset( $_REQUEST['form'] ) || 'sensei-login' != $_REQUEST['form'] ){ |
|
| 1528 | 1528 | |
| 1529 | - return ; |
|
| 1529 | + return ; |
|
| 1530 | 1530 | |
| 1531 | - } |
|
| 1531 | + } |
|
| 1532 | 1532 | |
| 1533 | - // Get the reffering page, where did the post submission come from? |
|
| 1534 | - $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']); |
|
| 1533 | + // Get the reffering page, where did the post submission come from? |
|
| 1534 | + $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']); |
|
| 1535 | 1535 | |
| 1536 | 1536 | // if there's a valid referrer, and it's not the default log-in screen |
| 1537 | - if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){ |
|
| 1538 | - // let's append some information (login=failed) to the URL for the theme to use |
|
| 1539 | - wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1540 | - exit; |
|
| 1541 | - } |
|
| 1537 | + if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){ |
|
| 1538 | + // let's append some information (login=failed) to the URL for the theme to use |
|
| 1539 | + wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1540 | + exit; |
|
| 1541 | + } |
|
| 1542 | 1542 | }// End sensei_login_fail_redirect_to_front_end_login |
| 1543 | 1543 | |
| 1544 | 1544 | /** |
@@ -1549,92 +1549,92 @@ discard block |
||
| 1549 | 1549 | function sensei_handle_login_request( ) { |
| 1550 | 1550 | |
| 1551 | 1551 | // Check that it is a sensei login request and if it has a valid nonce |
| 1552 | - if( isset( $_REQUEST['form'] ) && 'sensei-login' == $_REQUEST['form'] ) { |
|
| 1552 | + if( isset( $_REQUEST['form'] ) && 'sensei-login' == $_REQUEST['form'] ) { |
|
| 1553 | 1553 | |
| 1554 | - // Validate the login request nonce |
|
| 1555 | - if( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'sensei-login' ) ){ |
|
| 1556 | - return; |
|
| 1557 | - } |
|
| 1554 | + // Validate the login request nonce |
|
| 1555 | + if( !wp_verify_nonce( $_REQUEST['_wpnonce'], 'sensei-login' ) ){ |
|
| 1556 | + return; |
|
| 1557 | + } |
|
| 1558 | 1558 | |
| 1559 | - //get the page where the sensei log form is located |
|
| 1560 | - $referrer = $_REQUEST['_wp_http_referer']; |
|
| 1561 | - //$redirect = $_REQUEST['_sensei_redirect']; |
|
| 1559 | + //get the page where the sensei log form is located |
|
| 1560 | + $referrer = $_REQUEST['_wp_http_referer']; |
|
| 1561 | + //$redirect = $_REQUEST['_sensei_redirect']; |
|
| 1562 | 1562 | |
| 1563 | - if ( ( isset( $_REQUEST['log'] ) && !empty( $_REQUEST['log'] ) ) |
|
| 1564 | - && ( isset( $_REQUEST['pwd'] ) && !empty( $_REQUEST['pwd'] ) ) ){ |
|
| 1563 | + if ( ( isset( $_REQUEST['log'] ) && !empty( $_REQUEST['log'] ) ) |
|
| 1564 | + && ( isset( $_REQUEST['pwd'] ) && !empty( $_REQUEST['pwd'] ) ) ){ |
|
| 1565 | 1565 | |
| 1566 | - // when the user has entered a password or username do the sensei login |
|
| 1567 | - $creds = array(); |
|
| 1566 | + // when the user has entered a password or username do the sensei login |
|
| 1567 | + $creds = array(); |
|
| 1568 | 1568 | |
| 1569 | - // check if the requests login is an email address |
|
| 1570 | - if( is_email( trim( $_REQUEST['log'] ) ) ){ |
|
| 1571 | - // query wordpress for the users details |
|
| 1572 | - $user = get_user_by( 'email', sanitize_email( $_REQUEST['log'] ) ); |
|
| 1569 | + // check if the requests login is an email address |
|
| 1570 | + if( is_email( trim( $_REQUEST['log'] ) ) ){ |
|
| 1571 | + // query wordpress for the users details |
|
| 1572 | + $user = get_user_by( 'email', sanitize_email( $_REQUEST['log'] ) ); |
|
| 1573 | 1573 | |
| 1574 | - // validate the user object |
|
| 1575 | - if( !$user ){ |
|
| 1574 | + // validate the user object |
|
| 1575 | + if( !$user ){ |
|
| 1576 | 1576 | |
| 1577 | - // the email doesnt exist |
|
| 1578 | - wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1579 | - exit; |
|
| 1577 | + // the email doesnt exist |
|
| 1578 | + wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1579 | + exit; |
|
| 1580 | 1580 | |
| 1581 | - } |
|
| 1581 | + } |
|
| 1582 | 1582 | |
| 1583 | - //assigne the username to the creds array for further processing |
|
| 1584 | - $creds['user_login'] = $user->user_login ; |
|
| 1583 | + //assigne the username to the creds array for further processing |
|
| 1584 | + $creds['user_login'] = $user->user_login ; |
|
| 1585 | 1585 | |
| 1586 | - }else{ |
|
| 1586 | + }else{ |
|
| 1587 | 1587 | |
| 1588 | - // process this as a default username login |
|
| 1589 | - $creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ; |
|
| 1588 | + // process this as a default username login |
|
| 1589 | + $creds['user_login'] = sanitize_text_field( $_REQUEST['log'] ) ; |
|
| 1590 | 1590 | |
| 1591 | - } |
|
| 1591 | + } |
|
| 1592 | 1592 | |
| 1593 | 1593 | // get setup the rest of the creds array |
| 1594 | 1594 | $creds['user_password'] = sanitize_text_field( $_REQUEST['pwd'] ); |
| 1595 | 1595 | $creds['remember'] = isset( $_REQUEST['rememberme'] ) ? true : false ; |
| 1596 | 1596 | |
| 1597 | 1597 | //attempt logging in with the given details |
| 1598 | - $secure_cookie = is_ssl() ? true : false; |
|
| 1599 | - $user = wp_signon( $creds, $secure_cookie ); |
|
| 1598 | + $secure_cookie = is_ssl() ? true : false; |
|
| 1599 | + $user = wp_signon( $creds, $secure_cookie ); |
|
| 1600 | 1600 | |
| 1601 | 1601 | if ( is_wp_error($user) ){ // on login failure |
| 1602 | - wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1603 | - exit; |
|
| 1602 | + wp_redirect( esc_url_raw( add_query_arg('login', 'failed', $referrer) ) ); |
|
| 1603 | + exit; |
|
| 1604 | 1604 | }else{ // on login success |
| 1605 | 1605 | |
| 1606 | 1606 | /** |
| 1607 | - * change the redirect url programatically |
|
| 1608 | - * |
|
| 1609 | - * @since 1.6.1 |
|
| 1610 | - * |
|
| 1611 | - * @param string $referrer the page where the current url wheresensei login form was posted from |
|
| 1612 | - */ |
|
| 1607 | + * change the redirect url programatically |
|
| 1608 | + * |
|
| 1609 | + * @since 1.6.1 |
|
| 1610 | + * |
|
| 1611 | + * @param string $referrer the page where the current url wheresensei login form was posted from |
|
| 1612 | + */ |
|
| 1613 | 1613 | |
| 1614 | 1614 | $success_redirect_url = apply_filters('sesei_login_success_redirect_url', remove_query_arg( 'login', $referrer ) ); |
| 1615 | 1615 | |
| 1616 | 1616 | wp_redirect( esc_url_raw( $success_redirect_url ) ); |
| 1617 | - exit; |
|
| 1617 | + exit; |
|
| 1618 | 1618 | |
| 1619 | 1619 | } // end is_wp_error($user) |
| 1620 | 1620 | |
| 1621 | - }else{ // if username or password is empty |
|
| 1621 | + }else{ // if username or password is empty |
|
| 1622 | 1622 | |
| 1623 | - wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) ); |
|
| 1624 | - exit; |
|
| 1623 | + wp_redirect( esc_url_raw( add_query_arg('login', 'emptyfields', $referrer) ) ); |
|
| 1624 | + exit; |
|
| 1625 | 1625 | |
| 1626 | - } // end if username $_REQUEST['log'] and password $_REQUEST['pwd'] is empty |
|
| 1626 | + } // end if username $_REQUEST['log'] and password $_REQUEST['pwd'] is empty |
|
| 1627 | 1627 | |
| 1628 | - }elseif( ( isset( $_GET['login'] ) ) ) { |
|
| 1629 | - // else if this request is a redircect from a previously faile login request |
|
| 1630 | - $this->login_message_process(); |
|
| 1628 | + }elseif( ( isset( $_GET['login'] ) ) ) { |
|
| 1629 | + // else if this request is a redircect from a previously faile login request |
|
| 1630 | + $this->login_message_process(); |
|
| 1631 | 1631 | |
| 1632 | 1632 | //exit the handle login request function |
| 1633 | 1633 | return; |
| 1634 | - } |
|
| 1634 | + } |
|
| 1635 | 1635 | |
| 1636 | - // if none of the above |
|
| 1637 | - return; |
|
| 1636 | + // if none of the above |
|
| 1637 | + return; |
|
| 1638 | 1638 | |
| 1639 | 1639 | } // End sensei_login_fail_redirect_to_front_end_login |
| 1640 | 1640 | |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | */ |
| 1738 | 1738 | public function login_message_process(){ |
| 1739 | 1739 | |
| 1740 | - // setup the message variables |
|
| 1740 | + // setup the message variables |
|
| 1741 | 1741 | $message = ''; |
| 1742 | 1742 | |
| 1743 | 1743 | //only output message if the url contains login=failed and login=emptyfields |
@@ -1756,22 +1756,22 @@ discard block |
||
| 1756 | 1756 | }// end login_message_process |
| 1757 | 1757 | |
| 1758 | 1758 | |
| 1759 | - /** |
|
| 1760 | - * sensei_show_admin_bar(). Use WooCommerce filter |
|
| 1761 | - * to show admin bar to Teachers as well. |
|
| 1762 | - * |
|
| 1763 | - * @return void redirect |
|
| 1764 | - * |
|
| 1765 | - */ |
|
| 1766 | - public function sensei_show_admin_bar () { |
|
| 1759 | + /** |
|
| 1760 | + * sensei_show_admin_bar(). Use WooCommerce filter |
|
| 1761 | + * to show admin bar to Teachers as well. |
|
| 1762 | + * |
|
| 1763 | + * @return void redirect |
|
| 1764 | + * |
|
| 1765 | + */ |
|
| 1766 | + public function sensei_show_admin_bar () { |
|
| 1767 | 1767 | |
| 1768 | - if (current_user_can('edit_courses')) { |
|
| 1768 | + if (current_user_can('edit_courses')) { |
|
| 1769 | 1769 | |
| 1770 | - add_filter( 'woocommerce_disable_admin_bar', '__return_false', 10, 1); |
|
| 1770 | + add_filter( 'woocommerce_disable_admin_bar', '__return_false', 10, 1); |
|
| 1771 | 1771 | |
| 1772 | - } |
|
| 1772 | + } |
|
| 1773 | 1773 | |
| 1774 | - } |
|
| 1774 | + } |
|
| 1775 | 1775 | |
| 1776 | 1776 | } // End Class |
| 1777 | 1777 | |