The MU forums have moved to WordPress.org

turning e-mail address into unique login (10 posts)

  1. ceejayoz
    Member
    Posted 17 years ago #

    Has anyone tried hacking away at WPMU with the goal of allowing more than just a-z0-9 as user logins?

    I'm working on a project that would like to use e-mail addresses as logins (ala Facebook). It's unfortunately not as simple as just changing the value in the database - renaming my account from 'ceejayoz' to 'cj@ceejayoz.com' made wp-admin/ spin off into some sort of redirection loop.

    Any suggestions?

  2. beaulebens
    Member
    Posted 17 years ago #

    ceejayoz, I've got this working on my install, and it involved the following:

    1. Changing registration to auto-generate a username (I used an md5 hash of their email and some other stuff)

    2. Modifying the login code so that it'll accept an email address. This just checks if the "username" looks like an email address, and if it is, then it grabs whatever username is associated with that address and then continues with normal authentication from there -

    function allow_email_login($user, $pass) {
    	global $wpdb;
    	if (is_email($user)) {
    		$user = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_email = '$user'");
    	}
    	return;
    }
    add_action('wp_authenticate', 'allow_email_login', false, 2);

    3. I also modified my wp-login.php page to remove references to username (and avoid it re-filling the "username" field with my big ugly usernames) through the 'login_head' action, but I'll leave that up to you.

    HTH,

    Beau

  3. Achilleus
    Member
    Posted 16 years ago #

    Could you be a little more specific as to how this works? I'm attempting to do the same with my install of WPMU. I'm attempting to set up a webmail type of thing, so that when they register a new account, they would register user@acegamingsyndicate.net where user is whatever name they pick. The email account will be automatically created, and they use this email address to log in to the wordpress mu and bbpress.

  4. Achilleus
    Member
    Posted 16 years ago #

    bump

  5. Achilleus
    Member
    Posted 16 years ago #

    Anybody?

  6. Achilleus
    Member
    Posted 16 years ago #

    Still interested in this...

  7. dsader
    Member
    Posted 16 years ago #

  8. boonika
    Member
    Posted 16 years ago #

    I just viewed video tutorials on that site. Amazing work. Dsader, did You do it... the website?

  9. lunabyte
    Member
    Posted 16 years ago #

    Overall, it's PHP, you can make it do anything.

    However, it would take considerable hacking to the core files which would be a nightmare to upgrade.

  10. andrea_r
    Moderator
    Posted 16 years ago #

    No, dsader didn't do that site - beaulebens did above and he mentioned how he did it.

About this Topic

  • Started 17 years ago by ceejayoz
  • Latest reply from andrea_r