lisaleague
5/12/2015 - 12:50 AM

Display WooThemes Sensei comments and messages in a Genesis framework child theme. Insert in your child theme's functions.php file.

Display WooThemes Sensei comments and messages in a Genesis framework child theme. Insert in your child theme's functions.php file.

/**
 * Remove Sensei comments output and replace with comments done the Genesis way.
 *
 * @notes Extends the WooThemes_Sensei_Frontend class.
 *
 */

if (class_exists('WooThemes_Sensei_Frontend')) {
    remove_action( 'sensei_comments', array( $woothemes_sensei->frontend, 'sensei_output_comments' ), 10 );
    add_action( 'sensei_comments', array( 'WooThemes_Sensei_Frontend_Comments', 'pasada_sensei_output_comments' ), 10 );

    class WooThemes_Sensei_Frontend_Comments extends WooThemes_Sensei_Frontend
    {
        function pasada_sensei_output_comments()
        {
            global $woothemes_sensei, $view_lesson, $user_taking_course;
            $allow_comments = $woothemes_sensei->settings->settings['lesson_comments'];

            if ( is_user_logged_in() && $allow_comments && ( isset( $view_lesson ) && $view_lesson ) && ( isset( $user_taking_course ) && $user_taking_course )) {
                genesis_get_comments_template();
            } elseif ( is_singular( 'sensei_message' ) ) {
                genesis_get_comments_template();
            }
        }
    }
}