Skip to content

Commit

Permalink
Use WordPress to register/login instead of built-in functions. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
bor0 committed Oct 21, 2016
1 parent 121fc55 commit c34d471
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 109 deletions.
10 changes: 10 additions & 0 deletions includes/class-sensei-course.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,22 @@ public function __construct () {
// flush rewrite rules when saving a course
add_action('save_post', array( 'Sensei_Course', 'flush_rewrite_rules' ) );

add_action( 'template_redirect', array( $this, 'course_login' ), 10, 1 );


// Allow course archive to be setup as the home page
if ( (int) get_option( 'page_on_front' ) > 0 ) {
add_action( 'pre_get_posts', array( $this, 'allow_course_archive_on_front_page' ) );
}
} // End __construct()

public function course_login() {
if ( is_page( 'my-courses' ) && ! is_user_logged_in() ) {

wp_redirect( wp_login_url( get_permalink() ) );
}
}

/**
* Fires when a quiz has been graded to check if the Course status needs changing
*
Expand Down
109 changes: 0 additions & 109 deletions templates/user/login-form.php

This file was deleted.

0 comments on commit c34d471

Please sign in to comment.