WP-Members: Membership Framework
[resolved] [Plugin: WP-Members] Using Email for Username (4 posts)

  1. smerdyakov
    Posted 4 years ago #

    I've seen Beaulebean's plugin WP Login as Email and I'd love to integrate it with WP-Members. Is their a way I can hide the username field on the registration, and have it filled with the email that they enter?



  2. spectrus
    Posted 4 years ago #

    You can easily do it using JavaScript. Just hide the text box on page load, attach an 'onclick' handler to the submit button. Inside it grab the value of the 'e-mail' field and put it into the 'username' field. That way username will always be the same as e-mail in the DB. Not sure how you'd handle validation messages though, as they will not always be making sense after you've made your modification.

    I recommend jQuery library, as it can be easily included in the page (if it doesn't get included by default already), by making it a prerequisite for loading your own JS.

  3. dav_i
    Posted 4 years ago #

    Sorry to dig this up from the grave, but I needed to do the same thing, this is how I did it:

    FTP to the /wp-content/plugins/wp-members/ folder or use the editor built into wordpress and edit the following files in the following way:

    In wp-members-dialogs.php find and comment out the following code (around line 696)

    if( $toggle == 'edit' ) {
    		$form = $form . '<label for="username" class="text">' . __( 'Username', 'wp-members' ) . '</label>
    			<div class="div_text"><p class="noinput">' .
    				$userdata->user_login . 
    	} else {
    		$form = $form . '<label for="username" class="text">' . __( 'Choose a Username', 'wp-members' ) . '<font class="req">*</font></label>
    			<div class="div_text">
    				<input name="log" type="text" value="' . stripslashes( $username ) . '" class="username" id="username" />

    And in wp-members-register.php replace:

    $username = $_POST['log'];


    $username = $_POST['user_email'];

    and comment out the following

    if( !validate_username( $username ) ) { $wpmem_themsg = __( 'The username cannot include non-alphanumeric characters.', 'wp-members' ); return $wpmem_themsg; exit(); }

    Upload to server/save changes.

  4. Chad Butler
    Plugin Author

    Posted 4 years ago #

    If the functions you are editing to do that are pluggable, I would highly recommend maintaining them outside the plugin (see: http://butlerblog.com/2011/11/29/customizing-wp-members-with-pluggable-functions/). That way, it will be much easier to upgrade the plugin and stay current with updates.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic