public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/functions.php
/**
 * Get the access date for a unit based on the enrollment date and the details of the unit meta.
 *
 * @since 1.0.0
 *
 * @param integer $userID The ID of the user to get the details for.
 * @param object  $unitMeta An object with the meta data for this unit.
 *
 * @return integer The date that this unit should unlock if it's drip-fed.
 */
Get the access date for a unit based on the enrollment date and the details of the unit meta.

@param integer $userID The ID of the user to get the details for.
@param object  $unitMeta An object with the meta data for this unit.

@return integer The date that this unit should unlock if it's drip-fed.
Get the access date for a unit based on the enrollment date and the details of the unit meta . @param integer $userID The ID of the user to get the details for . @param object $unitMeta An object with the meta data for this unit . @return integer The date that this unit should unlock if it ' s drip - fed .
function WPCW_users_getUnitUnlockDate_forUser( $userID, $unitMeta ) {
	if ( ! $unitMeta ) {
		return false;
	}
	switch ( $unitMeta->unit_drip_type ) {
		case 'drip_specific':
			return $unitMeta->unit_drip_date_ts;
			break;
		case 'drip_interval':
			$enrolmentDate = WPCW_users_getCourseEnrolmentDate( $userID, $unitMeta->parent_course_id );
			return $unitMeta->unit_drip_interval + $enrolmentDate;
			break;
		default:
			return $enrolmentDate;
			break;
	}
	return false;
}
function WPCW_users_getUnitUnlockDate_forUser ( $ userID , $ unitMeta ) { if ( ! $ unitMeta ) { return false ; } switch ( $ unitMeta -> unit_drip_type ) { case 'drip_specific' : return $ unitMeta -> unit_drip_date_ts ; break ; case 'drip_interval' : $ enrolmentDate = WPCW_users_getCourseEnrolmentDate ( $ userID , $ unitMeta -> parent_course_id ) ; return $ unitMeta -> unit_drip_interval + $ enrolmentDate ; break ; default : return $ enrolmentDate ; break ; } return false ; }
Get the access date for a unit based on the enrollment date and the details of the unit meta.
Get the access date for a unit based on the enrollment date and the details of the unit meta .
// Calculate the future date based on the type. // Fetch the enrolement date for this user // Add the interval type, which is stored in seconds. // If unknown, just return the date the user registered.