<?php
add_shortcode('bw_login_form', 'login_form_shortcode');
function login_form_shortcode () {
	ob_start();

	if (is_user_logged_in()) {
		do_action('bw-member-links');
	} else {
		do_action('bw-login-form');
	}

	return ob_get_clean();
}

add_action('bw-login-form', function () {
	?>
		<h2 class="has-text-align-center">OWNERS’ LOGIN</h2>
		<div class="bw-login-form">
			<form name="bw-loginform" id="bw-loginform" action="<?php echo wp_login_url(); ?>" method="post">
				<div class="wp-success"></div>
				<p class="login-username">
					<label for="user_login">Username</label>
					<input type="text" name="log" id="user_login" class="input" value="" size="20">
				</p>
				<p class="login-password">
					<label for="user_pass">Password</label>
					<input type="password" name="pwd" id="user_pass" class="input" value="" size="20">
				</p>
				<p class="login-remember">
					<label><input name="rememberme" type="checkbox" id="rememberme" value="forever">Remember Me</label></p>
				<p class="login-submit">
					<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary" value="LOG IN">
					<input type="hidden" name="redirect_to" value="<?php echo get_home_url(); ?>">
				</p>
				
			</form>
			<div class="bw-login-form-nav clr">
				<a href="<?php echo wp_lostpassword_url(); ?>" class="bw-login-form-lost">Lost Password?</a>
			</div>
		</div>
	<?php
});
