WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Using Email for Username (4 posts)

  1. smerdyakov
    Member
    Posted 2 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?

    Thanks!
    Nick

    http://wordpress.org/extend/plugins/wp-members/

  2. spectrus
    Member
    Posted 2 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
    Member
    Posted 2 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 . 
    
    			'</p></div>';
    
    	} 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" />
    
    			</div>';
    	}

    And in wp-members-register.php replace:

    $username = $_POST['log'];

    with

    $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
    Member
    Plugin Author

    Posted 2 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

About this Topic

Tags