The MU forums have moved to WordPress.org

Username is Email Address (8 posts)

  1. Webmgr
    Member
    Posted 18 years ago #

    Greetings! I am the web manager at Muskingum College, and I am just getting started with Wordpress.

    In my environment, I would like to restrict the wp-signup.php page to only allow valid Muskingum email addresses to register. I also want the username, blogname, and email address to match. As a result of this logic, I want to only prompt for them to enter their username. Once they click next, I would like the value they submit for username to be used as the blogname (this is done already, and I set the blogname field as "readonly") AND I want the email address value to become username@muskingum.edu.

    For example if John Doe is a student and wants to register, he would register the username "johndoe" and click Next. This would be passed on as user_email johndoe@muskingum.edu and the blogname would become johndoe.

    Can anyone here clarify what I should be changing to make the username/email submission occur the way I want? I thought that changing $user_email to $user_name.'@muskingum.edu' would do the trick, but I have not been successful with that.

    Thanks for any advice!
    --Aaron M. Hall
    Muskingum Web Manager

  2. Webmgr
    Member
    Posted 18 years ago #

    Nevermind, I ended up changing wp-signup.php to reflect:

    function validate_user_form() {
    $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_name'].'@muskingum.edu');

    return $result;
    }

    and then I removed the lines for the E-mail Address input in "function show_user_form".

  3. samboll
    Member
    Posted 18 years ago #

    Awesome - thanks for this.

  4. drmike
    Member
    Posted 18 years ago #

    Actually we already have this feature. As site admin, login and Dashboard -> Site Admin -> Options -> Limited Email Registrations.

    Hope this helps even if it was late. :)

    -drmike

  5. dsader
    Member
    Posted 18 years ago #

    Clever, Webmgr.

    Does this "hack" disable a user's ability to create a second blog with jibberish for a blogname?

  6. Webmgr
    Member
    Posted 18 years ago #

    drmike, yes... and I already limited it to Muskingum.edu, however, I got to thinking after the fact that if we do that it becomes redundant to require a username AND an email address... especially when the username is part of the email. For my environment, this prevents non-Muskingum users from registering, while also requiring them to use valid usernames rather than "IamGod" and "angelbaby3732372234234" etc etc.

    dsader, in a manner of speaking, yes... since it requires a valid username to be entered in order to receive an email, it means they can't just enter jibberish. However, there's nothing stopping them from registering more than one blog unless you heavily edit the function signup_another_blog code.

    To be honest, I got really angry at the wp-signup.php code and rewrote most of it, lol. The problem is that my file is now VERY Muskingum specific or else I'd publish it here.

  7. mrjcleaver
    Member
    Posted 18 years ago #

    You can still publish it. And if someone else gets acts quickly, there is a window of opportunity for it to go back into the distro so everyone can benefit.

    The longer the mods are left diverged the greater the chance that the code base will become different, making it harder for Webmgr to take advantage of any newness in the core distro, and less compelling for anyone else to use these greatly useful features that Webmgr has invested in.

    As to where to publish it, I cannot advise. You could put it on trac, at least there donncha has easy access to it. Really it needs to be somewhere neutral - wpmudev.org is there for distributing finished products, not works in process. On codex you can't add attachments but you could add it as a topic. But, as codex is not prominently linked (e.g. by a sticky post or in the menus above) its not likely to get any traffic.

    Whatever you decide I recommend to Webmgr that you get your code out so that both you and the community have a chance to benefit.

  8. mwrenfro
    Member
    Posted 18 years ago #

    I needed something similar to what Webmgr described above. I got the unified diffs down to 108 lines. See my first real post at my freshly-installed WPMU site for more details.

About this Topic