PostType::add_capabilities()


Source

File: classes/PostType.php

	public function add_capabilities() {

		if ( is_admin() ) {
			$admin_role = get_role( 'administrator' );
			if ( ( $admin_role ) && ( $admin_role instanceof \WP_Role ) ) {
				if ( ! $admin_role->has_cap( 'delete_private_courses' ) ) {
					foreach ( $this->course_capabilities as $key => $cap ) {
						if ( ! $admin_role->has_cap( $cap ) ) {
							$admin_role->add_cap( $cap );
						}
					}
				}
				if ( ! $admin_role->has_cap( 'enroll_users' ) ) {
					$admin_role->add_cap( 'enroll_users' );
				}
			}
		}

	}