public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/functions.php
/**
 * Function called when a user quiz needs grading by the admin.
 *
 * @since 1.0.0
 *
 * @param integer $userID The ID of the user who's quiz needs grading
 * @param object  $quizDetails The details of the quiz that needs grading.
 */
Function called when a user quiz needs grading by the admin.

@param integer $userID The ID of the user who's quiz needs grading
@param object  $quizDetails The details of the quiz that needs grading.
Function called when a user quiz needs grading by the admin . @param integer $userID The ID of the user who ' s quiz needs grading @param object $quizDetails The details of the quiz that needs grading .
function WPCW_actions_userQuizNeedsGrading_notifyAdmin( $userID, $quizDetails ) {
	if ( ! $userID || ! $quizDetails ) {
		return;
	}
	$adminSubject = __( "Quiz Needs Grading Notification - {USER_NAME} - '{COURSE_TITLE}'", 'wp-courseware' );
	$adminBody    = __( "Hi Trainer!
Just to let you know, {USER_NAME} has just completed a quiz ({QUIZ_TITLE}), which requires grading. You can grade the question here:
{QUIZ_GRADE_URL}
{SITE_NAME}
{SITE_URL}
", 'wp-courseware' );
	$quizGradeURL = sprintf( '%s&user_id=%d&quiz_id=%d&unit_id=%d',
		admin_url( 'admin.php?page=WPCW_showPage_UserProgess_quizAnswers' ),
		$userID, $quizDetails->quiz_id, $quizDetails->parent_unit_id
	);
	$adminBody = str_ireplace( '{QUIZ_TITLE}', $quizDetails->quiz_title, $adminBody );
	$adminBody = str_ireplace( '{QUIZ_GRADE_URL}', $quizGradeURL, $adminBody );
	$userDetails    = get_userdata( $userID );
	$unitParentData = WPCW_units_getAssociatedParentData( $quizDetails->parent_unit_id );
	if ( $unitParentData->course_to_email ) {
		WPCW_email_sendEmail( $unitParentData,
			$userDetails,                                    
			$unitParentData->course_to_email,
			$adminSubject, $adminBody );
	}
		do_action( "wpcw_user_quiz_needs_marking_notification", $unitParentData, $userDetails, $adminSubject, $adminBody );
}
function WPCW_actions_userQuizNeedsGrading_notifyAdmin ( $ userID , $ quizDetails ) { if ( ! $ userID || ! $ quizDetails ) { return ; } $ adminSubject = __ ( " Quiz Needs Grading Notification - {USER_NAME} - '{COURSE_TITLE}' " , 'wp-courseware' ) ; $ adminBody = __ ( " Hi Trainer!

Just to let you know, {USER_NAME} has just completed a quiz ({QUIZ_TITLE}), which requires grading. You can grade the question here:
{QUIZ_GRADE_URL}

{SITE_NAME}
{SITE_URL}
 " , 'wp-courseware' ) ; $ quizGradeURL = sprintf ( '%s&user_id=%d&quiz_id=%d&unit_id=%d' , admin_url ( 'admin.php?page=WPCW_showPage_UserProgess_quizAnswers' ) , $ userID , $ quizDetails -> quiz_id , $ quizDetails -> parent_unit_id ) ; $ adminBody = str_ireplace ( '{QUIZ_TITLE}' , $ quizDetails -> quiz_title , $ adminBody ) ; $ adminBody = str_ireplace ( '{QUIZ_GRADE_URL}' , $ quizGradeURL , $ adminBody ) ; $ userDetails = get_userdata ( $ userID ) ; $ unitParentData = WPCW_units_getAssociatedParentData ( $ quizDetails -> parent_unit_id ) ; if ( $ unitParentData -> course_to_email ) { WPCW_email_sendEmail ( $ unitParentData , $ userDetails , $ unitParentData -> course_to_email , $ adminSubject , $ adminBody ) ; } do_action ( " wpcw_user_quiz_needs_marking_notification " , $ unitParentData , $ userDetails , $ adminSubject , $ adminBody ) ; }
Function called when a user quiz needs grading by the admin.
Function called when a user quiz needs grading by the admin .
// Generate the quiz name and URL to mark the quiz before passing for email to be sent. // User and Unit details // Check admin email address exists before sending. // User who's done the completion // Any additional admin-level notifications?
