LLMS_Privacy_Erasers::quiz_data( string $email_address, int $page )

Erase student quiz attempt data by email address


Parameters Parameters

$email_address

(string) (Required) email address of the user to retrieve data for

$page

(int) (Required) process page number


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/privacy/class-llms-privacy-erasers.php

	public static function quiz_data( $email_address, $page ) {

		$ret = self::get_return();

		$student = parent::get_student_by_email( $email_address );
		if ( ! $student ) {
			return $ret;
		}

		$enabled = llms_parse_bool( get_option( 'llms_erasure_request_removes_lms_data', 'no' ) );
		$query   = self::get_student_quizzes( $student, $page );

		foreach ( $query->get_attempts() as $attempt ) {

			if ( apply_filters( 'llms_privacy_erase_quiz_data', $enabled, $attempt ) ) {

				/* Translators: %d quiz attempt id. */
				$ret['messages'][]    = sprintf( __( 'Quiz attempt #%d removed.', 'lifterlms' ), $attempt->get_id() );
				$ret['items_removed'] = true;

				$attempt->delete();

			} else {

				/* Translators: %d quiz attempt id. */
				$ret['messages'][]     = sprintf( __( 'Quiz attempt #%d retained.', 'lifterlms' ), $attempt->get_id() );
				$ret['items_retained'] = true;

			}
		}

		$ret['done'] = $query->has_results() ? $query->is_last_page() : true;

		return $ret;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.18.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.