user2209868 user2209868 - 1 month ago 5
PHP Question

WordPress login form code

I have the following in a WordPress sidebar widget that serves as an online community for my niche. Right now I am able to display the form when the user is not logged in and to display the "Welcome to the Community!" message when the user is logged out -- which is great. However, the login functionality doesn't seem to be working. Could I please get some help?

<form name="loginform" id="loginform" action=""
<p class="login-username">
<label for="user_login">Username</label>
<input type="text" name="log" id="user_login" class="input" value=""
size="20" />
<p class="login-password">
<label for="user_pass">Password</label>
<input type="password" name="pwd" id="user_pass" class="input"
value="" size="20" />
<p class="login-submit">
<input type="submit" name="wp-submit" id="wp-submit" class="button-
primary" value="Log In" />
<input type="hidden" name="redirect_to"
value="" />

<?php } else { ?>
<h4>Welcome to the Community!<h4>
<?php } ?>

Rob Rob

try this...

if (!is_user_logged_in()) {
} else {
    echo '<h4>Welcome to the Community!</h4>';

You can also pass a configuration array to wp_login_form() See