Automattic / sensei

Sensei LMS - Online Courses, Quizzes, & Learning
https://senseilms.com
GNU General Public License v2.0
530 stars 197 forks source link

"is_sensei" function should return true for Sensei shortcodes #2055

Open chvillanuevap opened 6 years ago

chvillanuevap commented 6 years ago

Steps to Reproduce

  1. Add a new page that includes the [sensei_user_courses] shortcode in its content.
  2. Check if is_sensei() returns true or false.

What I Expected

I expected is_sensei() to return true.

What Happened Instead

is_sensei() returned false.

WordPress / Sensei version

WordPress 4.9.4 Sensei 1.9.20

Browser / OS version

Screenshot / Video

Context / Source

I have a function that disables Sensei styles, except for pages where is_sensei() returns true.

add_action( 'sensei_disable_styles', 'thepostmansknock_dequeue_sensei_styles', 999 );
/**
 * Dequeue WooThemes Sensei styles.
 *
 * @since 3.44.1
 */
function thepostmansknock_dequeue_sensei_styles() {
    if ( ! is_sensei() ) {
        return true;
    }
    return false;
}

The function does not load the stylesheet in pages where I used the [sensei_user_courses] shortcode.

chvillanuevap commented 5 years ago

I just wanted to add that is_sensei also returns false if we are on the course results endpoint. The function needs to check for the following:

if ( isset( $wp_query->query['course_results'] ) ) {
    return true;
}
donnapep commented 4 years ago

Note that this issue is only for the shortcodes. https://github.com/Automattic/sensei/issues/2055#issuecomment-503414372 will be handled by #3193.