Welcome to WebmasterWorld Guest from 54.146.217.179

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Wordpress Login validation on theme

Wordpress Login validation on theme

     
7:21 pm on May 2, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2009
posts: 51
votes: 0


Bit of a newbie here so bear with me.

I was able to find some code that almost did what I want which is essentially adding the wordpress login to my theme but the problem is that if there isn't a valid user it redirects to the wordpress back end. Is there a user_verify function or something out there that will simply display a message on the page?

Here's the code I currently have:



<?php if (!(current_user_can('level_0'))){ ?>


<div id="user_login">
<form action="<?php echo get_option('home'); ?>/wp-login.php" method="post">
<input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" />
<input type="password" name="pwd" id="pwd" size="20" />
<label class="username" for="log">Username</label>
<label class="password" for="password">Password</label>
<input type="submit" name="submit" value="Send" class="button" />
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</form>

<a class="register_now" href="?page_id=77">Register Now</a>
<img class="form_bottom" src="<?php bloginfo('template_directory'); ?>/library/images/form_bottom.png" />
</div>

<?php } ?>



Any help is greatly appreciated!
5:16 pm on May 5, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2009
posts: 51
votes: 0


Does anybody happen to know on this one or maybe a better solution or different solution.

I'm pretty desperate here so anything would help :)
11:03 pm on May 15, 2011 (gmt 0)

Moderator

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
posts:8135
votes: 93


Would these do the job:

[wordpress.org...]
[wordpress.org...]
6:04 pm on June 1, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2009
posts: 51
votes: 0


Hi Ergophobe,

Thanks for the suggestion but it actually kind of does the same thing were if you enter a wrong username and password it shoots you to the wordpress backend and gives you an error. I'm looking to keep you on the same page but give you an error.

Thanks :)
7:32 pm on June 1, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 31, 2002
posts:7575
votes: 0


I think you'll need to write something to do the check yourself. OR switch to a theme built to accommodate a user community like BuddyPress.
4:41 pm on June 2, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2009
posts: 51
votes: 0


Thanks lorax! I was hoping it wouldn't have to come to that but I think your right can't seem to find another way to do it.