-
Notifications
You must be signed in to change notification settings - Fork 191
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
WIP: Issues 1384 #1836
WIP: Issues 1384 #1836
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,6 @@ function give_check_logged_in_user_for_existing_email( $valid_data, $post ) { | |
* @return void | ||
*/ | ||
function give_process_form_login() { | ||
|
||
$is_ajax = isset( $_POST['give_ajax'] ); | ||
|
||
$user_data = give_donation_form_validate_user_login(); | ||
|
@@ -219,8 +218,11 @@ function give_process_form_login() { | |
* | ||
* @since 1.0 | ||
*/ | ||
do_action( 'give_ajax_donation_errors' ); | ||
give_die(); | ||
ob_start(); | ||
do_action( 'give_ajax_donation_errors' ); | ||
$message = ob_get_contents(); | ||
ob_end_clean(); | ||
wp_send_json_error( $message ); | ||
} else { | ||
wp_redirect( $_SERVER['HTTP_REFERER'] ); | ||
exit; | ||
|
@@ -230,8 +232,17 @@ function give_process_form_login() { | |
give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); | ||
|
||
if ( $is_ajax ) { | ||
echo 'success'; | ||
give_die(); | ||
$message = Give()->notices->print_frontend_notice( | ||
sprintf( | ||
/* translators: %s: user first name */ | ||
esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ), | ||
( isset( $user_data['user_first'] ) && ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @raftaar1191 Do not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
), | ||
false, | ||
'success' | ||
); | ||
|
||
wp_send_json_success( $message ); | ||
} else { | ||
wp_redirect( $_SERVER['HTTP_REFERER'] ); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raftaar1191 Can we use WordPress core function?
https://codex.wordpress.org/Function_Reference/wp_send_json_error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Commit id: raftaar1191@41bf6bf