| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template is used to display the login form with [give_login] |
| 4 |
*/ |
| 5 |
|
| 6 |
$get_data = give_clean( filter_input_array( INPUT_GET ) ); |
| 7 |
|
| 8 |
if ( ! is_user_logged_in() ) { |
| 9 |
|
| 10 |
if ( ! empty( $get_data['donation_id'] ) ) { |
| 11 |
$give_login_redirect = add_query_arg( |
| 12 |
'donation_id', |
| 13 |
$get_data['donation_id'], |
| 14 |
give_get_history_page_uri() |
| 15 |
); |
| 16 |
} |
| 17 |
|
| 18 |
// Show any error messages after form submission. |
| 19 |
Give()->notices->render_frontend_notices( 0 ); ?> |
| 20 |
<form id="give-login-form" class="give-form" action="" method="post"> |
| 21 |
<fieldset> |
| 22 |
<legend><?php esc_html_e( 'Log into Your Account', 'give' ); ?></legend> |
| 23 |
<?php |
| 24 |
/** |
| 25 |
* Fires in the login shortcode, before the login fields. |
| 26 |
* |
| 27 |
* Allows you to add new fields before the default fields. |
| 28 |
* |
| 29 |
* @since 1.0 |
| 30 |
*/ |
| 31 |
do_action( 'give_login_fields_before' ); |
| 32 |
?> |
| 33 |
<div class="give-login-username give-login"> |
| 34 |
<label for="give_user_login"><?php esc_html_e( 'Username or Email Address', 'give' ); ?></label> |
| 35 |
<input name="give_user_login" id="give_user_login" class="give-required give-input" type="text" required aria-required="true" /> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div class="give-login-password give-login"> |
| 39 |
<label for="give_user_pass"><?php esc_html_e( 'Password', 'give' ); ?></label> |
| 40 |
<input name="give_user_pass" id="give_user_pass" class="give-password give-required give-input" type="password" required aria-required="true" /> |
| 41 |
</div> |
| 42 |
|
| 43 |
<div class="give-login-submit give-login"> |
| 44 |
<input type="hidden" name="give_login_redirect" value="<?php echo esc_url( $give_login_redirect ); ?>" /> |
| 45 |
<input type="hidden" name="give_login_nonce" value="<?php echo wp_create_nonce( 'give-login-nonce' ); ?>" /> |
| 46 |
<input type="hidden" name="give_action" value="user_login" /> |
| 47 |
<input id="give_login_submit" type="submit" class="give_submit" value="<?php esc_html_e( 'Log In', 'give' ); ?>" /> |
| 48 |
</div> |
| 49 |
|
| 50 |
<div class="give-lost-password give-login"> |
| 51 |
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"> |
| 52 |
<?php esc_html_e( 'Reset Password', 'give' ); ?> |
| 53 |
</a> |
| 54 |
</div> |
| 55 |
<?php |
| 56 |
/** |
| 57 |
* Fires in the login shortcode, after the login fields. |
| 58 |
* |
| 59 |
* Allows you to add new fields after the default fields. |
| 60 |
* |
| 61 |
* @since 1.0 |
| 62 |
*/ |
| 63 |
do_action( 'give_login_fields_after' ); |
| 64 |
?> |
| 65 |
</fieldset> |
| 66 |
</form> |
| 67 |
<?php |
| 68 |
} elseif ( isset( $get_data['give-login-success'] ) && true === (bool) $get_data['give-login-success'] ) { |
| 69 |
|
| 70 |
Give_Notices::print_frontend_notice( |
| 71 |
apply_filters( 'give_successful_login_message', esc_html__( 'Login successful. Welcome!', 'give' ) ), |
| 72 |
true, |
| 73 |
'success' |
| 74 |
); |
| 75 |
} else { |
| 76 |
Give_Notices::print_frontend_notice( |
| 77 |
apply_filters( |
| 78 |
'give_already_logged_in_message', |
| 79 |
sprintf( |
| 80 |
/* translators: %s Redirect URL. */ |
| 81 |
__( 'You are already logged in to the site. <a href="%s">Click here</a> to log out.', 'give' ), |
| 82 |
esc_url( wp_logout_url() ) |
| 83 |
) |
| 84 |
), |
| 85 |
true, |
| 86 |
'warning' |
| 87 |
); |
| 88 |
} |
| 89 |
|