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

Fix - new enrolment email issue and google auth login does not work #511

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions classes/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,14 @@
* @since v2.0.5
*/
if ( self::should_order_auto_complete( $order_id ) ) {
// Mark enrollment as completed.
tutor_utils()->course_enrol_status_change( $enrolled_id, 'completed' );
// Mark complete only from client side.
$mark_completed = self::mark_order_complete( $order_id );
if ( $mark_completed ) {
$user_id = get_post_field( 'post_author', $enrolled_id );
$course_id = get_post_field( 'post_parent', $enrolled_id );
do_action( 'tutor_after_enrolled', $course_id, $user_id, $enrolled_id );
}
// Mark WC order as completed.
self::mark_order_complete( $order_id );
} else {
tutor_utils()->course_enrol_status_change( $enrolled_id, $status_to );
}

// Invoke enrolled hook.
if ( 'completed' === $status_to ) {
$user_id = get_post_field( 'post_author', $enrolled_id );
Expand All @@ -394,7 +391,7 @@
global $wpdb;
// Getting all of courses ids within this order.

$courses_ids = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key LIKE '_tutor_order_for_course_id_%' ", $order_id ) );

Check failure on line 394 in classes/WooCommerce.php

View workflow job for this annotation

GitHub Actions / WPCS

SQL wildcards for a LIKE query should be passed in through a replacement parameter. Found: LIKE '_tutor_order_for_course_id_%'.

if ( is_array( $courses_ids ) && count( $courses_ids ) ) {
$course_enrolled_by_order = array();
Expand Down Expand Up @@ -514,7 +511,7 @@
$fees_type = tutor_utils()->avalue_dot( 'fees_type', $tutor_earning_fees );

if ( $fees_amount > 0 ) {
if ( $fees_type === 'percent' ) {

Check failure on line 514 in classes/WooCommerce.php

View workflow job for this annotation

GitHub Actions / WPCS

Use Yoda Condition checks, you must.
$fees_amount = ( $total_price * $fees_amount ) / 100;
}

Expand Down Expand Up @@ -549,7 +546,7 @@
'commission_type' => $commission_type,
);
$pro_calculation = apply_filters( 'tutor_pro_earning_calculator', $pro_arg );
extract( $pro_calculation );

Check failure on line 549 in classes/WooCommerce.php

View workflow job for this annotation

GitHub Actions / WPCS

extract() usage is highly discouraged, due to the complexity and unintended issues it might cause.
// (Use Pro Filter - End).

// Prepare insertable earning data.
Expand Down Expand Up @@ -734,7 +731,7 @@

global $wpdb;
$table = $wpdb->base_prefix . 'postmeta';
$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$table} WHERE meta_key = '_tutor_course_product_id' AND meta_value = %d ", $woo_product_id ) );

Check failure on line 734 in classes/WooCommerce.php

View workflow job for this annotation

GitHub Actions / WPCS

Use placeholders and $wpdb->prepare(); found interpolated variable $table at "SELECT post_id FROM {$table} WHERE meta_key = '_tutor_course_product_id' AND meta_value = %d "

if ( $post_id ) {
$data = get_post_permalink( $post_id );
Expand Down
2 changes: 1 addition & 1 deletion views/options/field-types/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @since 2.0.0
*/

$field_key = sanitize_key( $field['key'] );
$field_key = $field['key'];
$default = isset( $field['default'] ) ? $field['default'] : false;
$value = $this->get( $field_key, $default );
$field_id = esc_attr( 'field_' . $field_key );
Expand Down
Loading