public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/userprogress.php
/**
		 * Quick function to check if the user can access the specified unit based on course settings.
		 *
		 * @param Integer $unitID The ID of the unit that's being checked.
		 * @param Boolean True if the unit can be accessed by this user, false otherwise.
		 */
Quick function to check if the user can access the specified unit based on course settings.
@param Integer $unitID The ID of the unit that's being checked.
@param Boolean True if the unit can be accessed by this user, false otherwise.
Quick function to check if the user can access the specified unit based on course settings . @param Integer $unitID The ID of the unit that ' s being checked . @param Boolean True if the unit can be accessed by this user false otherwise .
public function canUserAccessUnit( $unitID ) {
			if ( $unitID < 1 ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', false, $unitID, $this );
			}
			if ( wpcw_is_unit_admin_or_teacher( $unitID, $this->userID ) ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', true, $unitID, $this );
			}
			if ( ! $this->canUserAccessCourse() ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', false, $unitID, $this );
			}
			if ( ! $this->userCanOnlyAccessNext ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', true, $unitID, $this );
			}
			$this->loadUserUnitProgress();
			if ( isset( $this->unitListProgress[ $unitID ] ) ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', true, $unitID, $this );
			}
			$nextUnit = $this->getNextPendingUnit();
			if ( $nextUnit && $nextUnit->unit_id == $unitID ) {
				return apply_filters( 'wpcw_user_progress_canUserAccessUnit', true, $unitID, $this );
			}
			return apply_filters( 'wpcw_user_progress_canUserAccessUnit', false, $unitID, $this );
		}
public function canUserAccessUnit ( $ unitID ) { if ( $ unitID < 1 ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , false , $ unitID , $ this ) ; } if ( wpcw_is_unit_admin_or_teacher ( $ unitID , $ this -> userID ) ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , true , $ unitID , $ this ) ; } if ( ! $ this -> canUserAccessCourse ( ) ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , false , $ unitID , $ this ) ; } if ( ! $ this -> userCanOnlyAccessNext ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , true , $ unitID , $ this ) ; } $ this -> loadUserUnitProgress ( ) ; if ( isset ( $ this -> unitListProgress [ $ unitID ] ) ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , true , $ unitID , $ this ) ; } $ nextUnit = $ this -> getNextPendingUnit ( ) ; if ( $ nextUnit && $ nextUnit -> unit_id == $ unitID ) { return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , true , $ unitID , $ this ) ; } return apply_filters ( 'wpcw_user_progress_canUserAccessUnit' , false , $ unitID , $ this ) ; }
Quick function to check if the user can access the specified unit based on course settings.
Quick function to check if the user can access the specified unit based on course settings .
// Invalid unit // Check early on for admin or teacher. // Not allowed to access course. // Allowed to access all. // Allow access to anything that's complete. As user has already seen it. // Now check for the next item after what's been completed.