Skip to content
Open
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
9 changes: 6 additions & 3 deletions classes/Course.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@
} else {
$errors['pricing'] = __( 'Invalid product', 'tutor' );
}
} else {

Check failure on line 718 in classes/Course.php

View workflow job for this annotation

GitHub Actions / WPCS

If control structure block found as the only statement within an "else" block. Use elseif instead.
/**
* If user does not select WC product
* Then automatic WC product will be create name with course title.
Expand Down Expand Up @@ -852,7 +852,7 @@
update_post_meta( $post_id, self::COURSE_PRICE_TYPE_META, $params['pricing']['type'] );
}
} catch ( \Throwable $th ) {
throw new \Exception( $th->getMessage() );

Check failure on line 855 in classes/Course.php

View workflow job for this annotation

GitHub Actions / WPCS

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$th'.
}
}

Expand Down Expand Up @@ -1089,9 +1089,6 @@
public function ajax_create_course() {
tutor_utils()->check_nonce();

$course_id = intval( wp_unslash( $_POST['ID'] ?? 0 ) );
$this->check_access( $course_id ); // Check user cap for the given id before processing.

$params = Input::sanitize_array(
//phpcs:ignore WordPress.Security.NonceVerification.Missing
$_POST,
Expand All @@ -1101,6 +1098,12 @@
)
);

// This endpoint only creates new courses. Strip any fields that could
// cause wp_insert_post() to update an existing post or write arbitrary meta.
unset( $params['ID'], $params['import_id'], $params['meta_input'] );

$this->check_access();

$params['post_type'] = tutor()->course_post_type;

// Validate inputs.
Expand Down
Loading