382 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Located in New Zealand
  • Had an item featured on Envato Market
+5 more
PixelStores
says

Hey,

I have been searching around for some time now looking for a login form to place in my sidebar.

I want the user to be redirected to the page they have logged in and also display an error message if the Username or Password is incorrect.

Can this be done without a plugin?

Here is a typical login form that redirects the user if he/she has logged in, however if the login details are incorrect the user is redirected to the wordpress login panel /wp-login.php.

<form method="post" action="<?php bloginfo('url') ?>/wp-login.php">

<p>
<label for="log"><input name="log" size="22" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" type="text" /> User</label><br />

<label for="pwd"><input name="pwd" size="22" id="pwd" type="password" /> Password</label><br />
<input name="submit" class="button" value="Send" type="submit" />

<label for="rememberme"><input checked="checked" name="rememberme" id="rememberme" value="forever" type="checkbox" /> Remember me</label><br />
</p>

<input name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" type="hidden" />

</form>

Any help appreciated :)

Matt

1618 posts
  • Had an item that was trending
  • Made it to the Authors' Hall of Fame
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 6 years
+7 more
fuelthemes
says

I use it in my phiyaz theme. When logged in, theme dispays account panel, latest posts. When logged out, displays login/register forms.

http://themeforest.net/item/phiyaz-entertaintment-community-theme/67220

I don’t remember adding any redirection. I think wordpress handles this automatically.

3439 posts
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Achieved the monthly Community Superstar Award
  • Located in United States
+2 more
organicbee
says
382 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Located in New Zealand
  • Had an item featured on Envato Market
+5 more
PixelStores
says

Cheers guys for your help but unfortunately both login forms redirect the user to wp-login.php from an incorrect user or pass.

@turkhitbox, try logging in with a wrong username or password, you see what i mean. :p

Any ideas?

Cheers

by
by
by
by
by
by