Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook added for third-party #499

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions classes/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"SELECT count(umeta_id)
FROM {$wpdb->usermeta}
WHERE user_id = %d
AND meta_key IN ('{$in_ids}')

Check failure on line 792 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $in_ids at AND meta_key IN ('{$in_ids}')

",
$user_id
)
Expand Down Expand Up @@ -851,8 +851,8 @@
FROM (
SELECT DISTINCT quiz_id, course_id, attempt_status
FROM {$wpdb->tutor_quiz_attempts}
WHERE quiz_id IN ({$quiz_ids_str})

Check failure on line 854 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $quiz_ids_str at WHERE quiz_id IN ({$quiz_ids_str}) 

AND user_id = % d

Check failure on line 855 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Found unescaped literal "%" character.
AND attempt_status != %s
) a",
$user_id,
Expand Down Expand Up @@ -881,7 +881,7 @@
WHERE comment_type = %s
AND comment_approved = %s
AND user_id = %d
AND comment_post_ID IN({$assignment_ids_str});

Check failure on line 884 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $assignment_ids_str at AND comment_post_ID IN({$assignment_ids_str});

",
'tutor_assignment',
'submitted',
Expand Down Expand Up @@ -1252,7 +1252,7 @@
$user_id = $this->get_user_id( $user_id );

// Delete Quiz submissions.
$attempts = \Tutor\Models\QuizModel::get_quiz_attempts_by_course_ids( $start = 0, $limit = 99999999, $course_ids = array( $course_id ), $search_filter = '', $course_filter = '', $date_filter = '', $order_filter = '', $user_id = $user_id, false, true );

Check failure on line 1255 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Assignments must be the first block of code on a line

if ( is_array( $attempts ) ) {
$attempt_ids = array_map(
Expand Down Expand Up @@ -1387,7 +1387,7 @@
* @since 1.0.0
* @since 1.4.8 Legacy Supports Added.
*
* @param int $lesson_id

Check failure on line 1390 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Missing parameter comment
*
* @return bool|mixed
*/
Expand All @@ -1405,7 +1405,7 @@
return $course_id;
}

/**

Check failure on line 1408 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Doc comment for parameter "$post_type" missing
* Get first lesson of a course
*
* @since 1.0.0
Expand All @@ -1428,7 +1428,7 @@
ON topic.ID = items.post_parent
WHERE topic.post_parent = %d
AND items.post_status = %s
" . ( $post_type ? " AND items.post_type='{$post_type}' " : '' ) . '

Check failure on line 1431 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found $post_type

Check failure on line 1431 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found ?

Check failure on line 1431 in classes/Utils.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $post_type at " AND items.post_type='{$post_type}' "
ORDER BY topic.menu_order ASC,
items.menu_order ASC;
',
Expand Down Expand Up @@ -2557,6 +2557,14 @@
delete_post_meta( $order_id, '_is_tutor_order_for_course' );
delete_post_meta( $order_id, '_tutor_order_for_course_id_' . $course_id );
}

/**
* Added for third-party
*
* @since 2.2.3
*/
do_action( 'tutor_after_enrollment_deleted', $course_id, $user_id );

} else {
$wpdb->update(
$wpdb->posts,
Expand All @@ -2568,6 +2576,13 @@
)
);

/**
* Added for third-party
*
* @since 2.2.3
*/
do_action( 'tutor_after_enrollment_cancelled', $course_id, $user_id );

if ( 'cancel' === $cancel_status ) {
die( esc_html( $cancel_status ) );
}
Expand Down
Loading