Login form of wordpress

Published
August 25, 2022
浏览次数 :  0

//login form 
function ppo_login_form($login_only  = 0) {
	global $user_ID, $user_identity, $user_level;
	$redirect = site_url();
	if($user_ID) :  
	?>
	<?php if(empty($login_only)) : ?>
		<div id="user-login bg-warning">
			<!-- <span class="author-avatar"><?php //echo get_avatar( $user_ID, $size = '90'); ?></span> -->
			<p class="welcome-text"><?php _eti( 'Welcome' ) ?> <strong><?php echo $user_identity ?></strong> .</p>
			<ul>
				<li><a href="<?php echo admin_url() ?>"><?php _eti( 'Dashboard' ) ?> </a></li>
				<li><a href="<?php echo admin_url() ?>profile.php"><?php _eti( 'Your Profile' ) ?> </a></li>
				<li><a href="<?php echo wp_logout_url($redirect); ?>"><?php _eti( 'Logout' ) ?> </a></li>
			</ul>
			<div class="clear"></div>
		</div>
	<?php endif; ?>
<?php else : ?>

	<div class="view show" id="modal-signin-view">
    <div class="modal-header border-0 pb-0 px-md-5 px-4 d-block position-relative">
      <h3 class="modal-title mt-4 mb-0 text-center"><?php _eti('Sign In'); ?></h3>
      <button type="button" class="btn-close position-absolute" style="top: 1.5rem; right: 1.5rem;" data-bs-dismiss="modal" aria-label="Close"></button>
    </div>
    <div class="modal-body px-md-5 px-4">
      <p class="fs-sm text-muted text-center"><?php bloginfo('description') ?></p>
      <!-- LOGIN-FORM -->
      <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php','login_post' )); ?>" class="needs-validation" novalidate="" method="post">
      	<!-- email or username -->
        <div class="mb-4" id="log-username">
          <label for="log" class="form-label-lg"><?php _eti('Username') ?></label>
          <input type="text" class="form-control" id="log" name="log" placeholder="Your username" required="">
        </div>
        <!-- password -->
        <div class="mb-4" id="log-pass">
          <label for="pwd" class="form-label-lg">Password</label>
          <div class="password-toggle">
            <input class="form-control" name="pwd" type="password" id="pwd" value="">
            <label class="password-toggle-btn" aria-label="Show/hide password">
              <input class="password-toggle-check" type="checkbox">
              <span class="password-toggle-indicator"></span>
            </label>
          </div>
        </div>

        <div class="d-flex justify-content-between align-items-center mb-4">
          <div class="form-check">
            <input type="checkbox" class="form-check-input" id="rememberme" name="rememberme" checked="checked" value="forever">
            <label for="remember-me" class="form-check-label fs-base"><?php _eti('Remember me') ?></label>
          </div>
          <a href="<?php echo wp_lostpassword_url( $redirect ); ?>" class="fs-sm text-decoration-none"><?php _eti('Lost your password?') ?></a>
        </div>


        <button type="submit" name="submit" class="btn login-button btn-primary btn-hover-shadow d-block w-100">LOG in</button>
        <p class="fs-sm pt-4 mb-0">
          <?php _e('Don\'t have account yet?'); ?>
          <a href="<?php echo wp_registration_url() ?>" class="fw-bold text-decoration-none" data-view="#modal-signup-view">Sign up</a>
        </p>
        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
      </form>
      <!-- end of loginform -->
    </div>
  </div>

	<?php 
endif;
}

Top