Created
March 25, 2020 08:19
-
-
Save abubackerbsc/0ba7b608784afbd0fa72804adab8d23b to your computer and use it in GitHub Desktop.
Front - Modal user account singup text redirect to my account page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function front_header_user_account_login_form() { | |
$header_account_view = apply_filters( 'front_header_topbar_user_account_view', 'dropdown' ); | |
?> | |
<form class="js-validate woocommerce-form woocommerce-form-login login" method="post"> | |
<div id="login" data-target-group="idForm" style="<?php echo esc_attr( ( isset( $_POST['register'] ) || isset( $_POST['recoverPassword'] ) ) ? 'display: none; opacity: 0;' : 'display: block; opacity: 1;' ); ?>"> | |
<?php if ( $header_account_view == 'modal' || $header_account_view == 'sidebar-left' || $header_account_view == 'sidebar-right' ): ?> | |
<header class="<?php echo esc_attr( $header_account_view == 'modal' ? 'card-header bg-light py-3 px-5' : 'text-center mb-7' ); ?>"> | |
<?php if ( $header_account_view == 'modal' ): ?> | |
<div class="d-flex justify-content-between align-items-center"> | |
<h3 class="h6 mb-0"><?php echo apply_filters( 'front_user_account_not_login_text', esc_html__( 'Welcome Back!', 'front' ) ); ?></h3> | |
<button type="button" class="close" aria-label="Close" onclick="Custombox.modal.close();"> | |
<span aria-hidden="true">×</span> | |
</button> | |
</div> | |
<?php else : ?> | |
<h2 class="h4 mb-0"><?php echo apply_filters( 'front_user_account_not_login_text', esc_html__( 'Welcome Back!', 'front' ) ); ?></h2> | |
<p><?php echo apply_filters( 'front_user_account_not_login_description', esc_html__( 'Login to manage your account.', 'front' ) ); ?></p> | |
<?php endif ?> | |
</header> | |
<?php endif ?> | |
<?php if ( $header_account_view == 'dropdown' ): ?> | |
<div class="card-header bg-light text-center py-3 px-5"> | |
<h3 class="h6 mb-0"><?php echo apply_filters( 'front_user_account_not_login_text', esc_html__( 'Login to Front', 'front' ) ); ?></h3> | |
</div> | |
<?php endif ?> | |
<?php if ( $header_account_view == 'modal' || $header_account_view == 'dropdown' ): ?> | |
<div class="card-body p-5"> | |
<?php endif ?> | |
<?php do_action( 'front_myaccount_woocommerce_login_form_custom_field_before' ); ?> | |
<div class="form-group"> | |
<div class="js-form-message js-focus-state"> | |
<label class="sr-only" for="signinSrEmail"><?php esc_html_e( 'Email', 'front' ); ?></label> | |
<div class="input-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text" id="signinEmail"> | |
<span class="fas fa-user"></span> | |
</span> | |
</div> | |
<input type="text" class="form-control" name="username" id="username" placeholder="<?php esc_attr_e( 'Email', 'front' ); ?>" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<div class="js-form-message js-focus-state"> | |
<label class="sr-only" for="signinSrPassword"><?php esc_html_e( 'Password', 'front' ); ?></label> | |
<div class="input-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text" id="signinPassword"> | |
<span class="fas fa-lock"></span> | |
</span> | |
</div> | |
<input class="form-control" type="password" placeholder="<?php esc_attr_e( 'Password', 'front' ); ?>" name="password" id="password" autocomplete="current-password" /> | |
</div> | |
</div> | |
</div> | |
<?php do_action( 'front_myaccount_woocommerce_login_form_custom_field_after' ); ?> | |
<span class="d-flex justify-content-end mb-4"> | |
<a class="js-animation-link link-muted<?php echo esc_attr( $header_account_view != 'dropdown' ? ' small' : '' ) ?>" href="javascript:;" data-target="#forgotPassword" data-link-group="idForm" data-animation-in="fadeIn"><?php esc_html_e( 'Forgot Password?', 'front' ); ?></a> | |
</span> | |
<?php | |
if ( isset( $_POST['login'] ) ) { | |
// show any error messages after form submission | |
?><div class="mb-3"><?php woocommerce_output_all_notices(); ?></div><?php | |
} | |
?> | |
<div class="mb-2"> | |
<?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?> | |
<button type="submit" class="btn btn-block btn-primary transition-3d-hover<?php echo esc_attr( $header_account_view == 'dropdown' ? ' btn-sm' : '' ) ?>" name="login" value="<?php esc_attr_e( 'Log in', 'front' ); ?>"><?php esc_html_e( 'Login', 'front' ); ?></button> | |
</div> | |
<?php if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' ) : | |
$enable_register_redirect = apply_filters( 'woocommerce_header_my_account_modal_login_form_redirect', false ); ?> | |
<div class="text-center<?php echo esc_attr( $header_account_view != 'dropdown' ? ' mb-4' : '' ) ?>"> | |
<span class="text-muted<?php echo esc_attr( $header_account_view != 'dropdown' ? ' small' : '' ) ?>"><?php esc_html_e( 'Don\'t have an account?', 'front' ); ?></span> | |
<a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>"> | |
<?php esc_html_e( 'Signup', 'front' ); ?> | |
</a> | |
</div> | |
<?php endif; ?> | |
<?php if ( $header_account_view == 'modal' || $header_account_view == 'dropdown' ): ?> | |
</div> | |
<?php endif ?> | |
</div> | |
</form><?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment