Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wordpress Front End Login

Featured Replies

Hi everyone,

 

I'm creating a membership site using 'Membership' from WPMUDev (http://premium.wpmudev.org/project/membership). Is there a simple (or slightly challenging) way to create a login form that is accessed from the front end of the website? I'd prefer it if non-administrators didn't go near '/wp-login.php'. I had assumed there would be one included with the plugin, but I'm yet to find it.

 

Cheers,

 

Chris

Edited by Chris Higgins

 

Good find, but why on earth would someone use GitHub for a WP plugin? It totaly fails to take advantage of the WP update mechanism, which you get automatically by storing your plugin in the wordpress.org SVN repo.

Good find, but why on earth would someone use GitHub for a WP plugin? It totaly fails to take advantage of the WP update mechanism, which you get automatically by storing your plugin in the wordpress.org SVN repo.

 

 

Cos it's for cool kids, yo.

Good find, but why on earth would someone use GitHub for a WP plugin? It totaly fails to take advantage of the WP update mechanism, which you get automatically by storing your plugin in the wordpress.org SVN repo.

 

To be honest I've no idea!

 

Same thing is found here..

 

http://wordpress.org/extend/plugins/sidebar-login/

 

I've not tried it myself but it seems to get mixed reviews

  • Author

Just copy the form from wp-login.php, adding a hidden field called "redirect_to" populated with the URL of the current page.

 

 

Sounds easy enough... ;)

 

I've copied what I think is the right code from wp-login.php, and it does result in a login form on the front end of the site. Mission accomplished.

 

I'm a bit confused by the hidden field bit. I replaced the value on the second last line of the code to my websites URL, and it seems to work. Is that all I have to do?

 

 

<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
<p>
	<label for="user_login"><?php _e('Username') ?><br />
	<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
</p>
<p>
	<label for="user_pass"><?php _e('Password') ?><br />
	<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
</p>
<?php do_action('login_form'); ?>
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
<p class="submit">
	<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
<?php	if ( $interim_login ) { ?>
	<input type="hidden" name="interim-login" value="1" />
<?php	} else { ?>
	<input type="hidden" name="redirect_to" value="http://www.myurl.com/" />
<?php 	} ?>
	<input type="hidden" name="testcookie" value="1" />
</p>
</form>

That field gives you the opportunity to either redirect the user to the same page they logged in from or a page of your choosing on successful login - it's passed to wp-login.php, which handles the form submission.

Just copy the form from wp-login.php, adding a hidden field called "redirect_to" populated with the URL of the current page.

 

Actually that's a good tip - I think I will employ that on a future build. +1

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.