function user_removed_from_blog($user_id, $blog_id)
 {
     //Fetch users GUID and bail if GUEST
     $CAS = class_exists('\\GlobalTechnology\\CentralAuthenticationService\\CASLogin') ? \GlobalTechnology\CentralAuthenticationService\CASLogin::singleton() : \WPGCXPlugin::singleton();
     $guid = $CAS->get_user_guid($user_id);
     if ($guid == 'GUEST') {
         return;
     }
     //Fetch all EKKO courses
     $courses = CoursePostType::singleton()->get_courses();
     if (empty($courses)) {
         return;
     }
     $session = Services\Hub::singleton()->get_session(true);
     foreach ($courses as $course) {
         error_log("Course ID: " . $course->course_ID);
         if ($course_ID = $course->course_ID) {
             Services\Hub::singleton()->update_users($course_ID, array(), array($guid), Services\Hub::ENDPOINT_ADMINS, $session);
         }
     }
 }
 /**
  * Creates a new User
  *
  * @param string $guid
  * @param array  $args
  *
  * @return null|\WP_User
  */
 public final function create_user($guid, array $args)
 {
     $class = class_exists('\\GlobalTechnology\\CentralAuthenticationService\\CASLogin') ? \GlobalTechnology\CentralAuthenticationService\CASLogin::singleton() : \WPGCXPlugin::singleton();
     return $class->create_user($guid, $args);
 }
    public final function display_page()
    {
        $hub = \Ekko\Core\Services\Hub::singleton();
        $post = get_post($_REQUEST['post']);
        $course = \Ekko\Core\CoursePostType::singleton()->get_course($post);
        $course_id = $course->course_ID;
        ?>
			<div class="wrap">
				<div id="icon-post" class="icon32"><br /></div>
				<h2>
					<?php 
        _e('Publish Course', \Ekko\TEXT_DOMAIN);
        ?>
					<a href="edit.php?post_type=ekko-course" class="add-new-h2">Return to Courses</a>
				</h2>

				<div class="ekko-bootstrap">
					<div><h1><?php 
        _e(sprintf('Publishing Course: %1$s', $course->post_title));
        ?>
</h1></div>
					<div class="well">
						<p><?php 
        if ($course_id === false) {
            $course_id = $hub->create_course($course->get_manifest());
        } else {
            $hub->update_course($course_id, $course->get_manifest());
        }
        $course->course_ID = $course_id;
        esc_html_e('Updating Course Manifest.', \Ekko\TEXT_DOMAIN);
        ?>
						</p>

						<p><?php 
        esc_html_e('Processing Course Media:', \Ekko\TEXT_DOMAIN);
        $existing_resources = $hub->get_resources($course_id);
        $resources = $course->resources;
        ?>
						<ul><?php 
        foreach ($resources as $resource) {
            if ($resource->type == 'file') {
                echo sprintf('<li>%1$s</li>', basename($resource->file));
                if (!in_array($resource->sha1, $existing_resources['files'])) {
                    $hub->upload_resource($course_id, $resource->file, $resource->mimeType);
                }
            } elseif ($resource->type == 'ecv') {
                echo sprintf('<li>%1$s</li>', basename($resource->title));
                if (!in_array($resource->ecv_id, $existing_resources['videos'])) {
                    $hub->add_course_to_video($resource->ecv_id, $course_id);
                }
            }
        }
        ?>
						</ul>
						</p><?php 
        $result = $hub->publish_course($course_id);
        ?>

						<p class="<?php 
        echo $result === true ? 'text-success' : 'text-error';
        ?>
"><?php 
        if ($result === true) {
            esc_html_e('Course successfully published!', \Ekko\TEXT_DOMAIN);
        } else {
            echo '<strong>' . esc_html__('One or more Errors occured during publish', \Ekko\TEXT_DOMAIN) . ':</strong>';
            if (is_array($result)) {
                foreach ($result as $error) {
                    echo '<div>' . esc_html($error) . '</div>';
                }
            }
        }
        ?>
						</p>

					</div>
				</div>
			</div>
			<?php 
        $admins = array();
        foreach (get_users() as $user) {
            $class = class_exists('\\GlobalTechnology\\CentralAuthenticationService\\CASLogin') ? \GlobalTechnology\CentralAuthenticationService\CASLogin::singleton() : \WPGCXPlugin::singleton();
            $guid = $class->get_user_guid($user);
            if ($user->has_cap('administrator')) {
                $admins[] = $guid;
            }
        }
        $hub->sync_admins($course_id, $admins);
    }