Beispiel #1
0
 /**
  * Install.
  *
  * @param bool $inc_post_types
  * @param bool $inc_endpoints
  */
 public function activate($inc_post_types = true, $inc_endpoints = true)
 {
     // Setup the database tables.
     $this->setup_tables();
     // Setup the user roles and capabilities.
     $this->setup_roles();
     // Post types and taxonomies.
     if ($inc_post_types || $inc_endpoints) {
         if ($inc_post_types) {
             Edr_PostTypes::register_post_types();
             Edr_PostTypes::register_taxonomies();
         }
         if ($inc_endpoints) {
             IB_Educator_Main::add_rewrite_endpoints();
         }
         flush_rewrite_rules();
     }
     // Setup email templates.
     $this->setup_email_templates();
     // Schedule cron events.
     $this->schedule_events();
     // Setup tax settings.
     $this->setup_taxes();
     // Do version specific updates.
     $current_version = get_option('ib_educator_version');
     if ($current_version) {
         if (version_compare($current_version, '1.4.3', '<=')) {
             $this->update_1_4_4();
         }
         if (version_compare($current_version, '1.5', '<=')) {
             $this->update_1_6();
         }
     }
     /**
      * Plugin activation hook.
      */
     do_action('ib_educator_activation');
     // Update the plugin version in database.
     update_option('ib_educator_version', IBEDUCATOR_VERSION);
 }
Beispiel #2
0
require IBEDUCATOR_PLUGIN_DIR . 'includes/ib-educator.php';
require IBEDUCATOR_PLUGIN_DIR . 'includes/formatting.php';
require IBEDUCATOR_PLUGIN_DIR . 'includes/functions.php';
require IBEDUCATOR_PLUGIN_DIR . 'includes/ib-educator-main.php';
require IBEDUCATOR_PLUGIN_DIR . 'includes/shortcodes.php';
require IBEDUCATOR_PLUGIN_DIR . 'includes/filters.php';
// Register the quizzes service.
function edr_get_quizzes_service()
{
    return new Edr_Quizzes();
}
Edr_Manager::add('edr_quizzes', 'edr_get_quizzes_service');
// Setup the memberships feature.
Edr_MembershipsRun::init();
// Setup the post types and taxonomies.
Edr_PostTypes::init();
// Setup Educator.
IB_Educator_Main::init();
// Ajax actions.
Edr_AjaxActions::init();
// Setup account processing (e.g. payment form).
Edr_StudentAccount::init();
// Parse incoming requests (e.g. PayPal IPN).
Edr_RequestDispatcher::init();
if (is_admin()) {
    // Setup the Educator's admin.
    Edr_Admin::init();
    // Check whether to run the update script or not.
    function ib_edu_update_check()
    {
        if (get_option('ib_educator_version') != IBEDUCATOR_VERSION) {
Beispiel #3
0
 public static function clear_current_user_courses()
 {
     self::$current_user_courses = null;
 }
 /**
  * Test if lesson comments are retrieved for registered users.
  */
 public function testLessonCommentsQueryRegistered()
 {
     global $wp_the_query;
     $tmp = $wp_the_query;
     // Add a comment.
     wp_insert_comment(array('comment_post_ID' => $this->lessons[2], 'comment_author' => 'admin', 'comment_author_email' => '*****@*****.**', 'comment_approved' => 1, 'comment_date' => current_time('mysql'), 'comment_content' => 'lesson comment content', 'comment_author_IP' => '127.0.0.1', 'comment_type' => ''));
     Edr_PostTypes::clear_current_user_courses();
     $wp_the_query = new WP_Query();
     $wp_the_query->query(array('feed' => 'rss2', 'post_type' => 'ib_educator_lesson', 'name' => 'course-3-lesson-1'));
     $this->assertEquals(1, $wp_the_query->comment_count);
     $wp_the_query = $tmp;
 }