email as login name?

Discussion in 'Customization & add-ons' started by leeds1, Jan 22, 2006.

  1. leeds1

    leeds1 New Member

    Joined:
    Jan 22, 2006
    Messages:
    1
    Hi

    I would just like my subs to sign up with their email as their login name so they just need to provide:

    email address and password

    thus not having to type in first & last name and username

    can this be done? and how?

    may thanks
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Please contact support via helpdesk.
  3. david05

    david05 New Member

    Joined:
    Jul 4, 2005
    Messages:
    40
    Alex,

    This may be of alot of interest to othe aMember users, I was thinking about doing this type of login myself. I just hadn't had the time to ask you about it yet!

    Is there any chance of posting your solution here for me and others to look at?

    Thanks,

    David
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    I will try.

    1. Edit file amember/templates/signup.html and remove the following lines:
    PHP:
    {if not $config.generate_login}
    <
    script>
    function 
    checkUniqLogin(){
        var 
    login=document.forms['signup'].elements['login'].value;
        var 
    email=document.forms['signup'].elements['email'].value;
        {/
    literal}{if not $config.generate_pass}
        var 
    word=document.forms['signup'].elements['pass0'].value;
        {else}
        var 
    word="";
        {/if}{
    literal}
        
    window.open('uniq_login.php?login='+login+'&email='+email+'&word='+word'',
        
    'dependent=1,directories=0,height=400,width=300,location=0');
    }
    </
    script>
    <
    tr>
        <
    th><b>Choose a Login Name (User ID)</b><br><br>
        <
    small>It must be {$config.login_min_length} or more characters in length and may<br>
               
    only contain small lettersnumbers, and<br>the underscore '_'</small></th>
        <
    td nowrap><input type=text name=login value="{$smarty.request.login|escape}size=15 maxlength=15>
        <
    a href="javascript:checkUniqLogin()"><small>check for uniqueness</small></a>
        </
    td>
    </
    tr>
    {/if}
    2. Edit file amember/signup.php, replace
    PHP:
    $vars = & get_input_vars();
    to
    PHP:
    $vars = & get_input_vars();
    $vars['login'] = $vars['email'];
    and
    PHP:
        if (preg_match('/[^0-9a-zA-Z_ ]+/'$vars['login'])){
    to
    PHP:
        if (preg_match('/[^0-9a-zA-Z@_ ]+/'$vars['login'])){
    3. Enable aMember Cp -> Setup -> Require Unique Email

    It should work.
  5. david05

    david05 New Member

    Joined:
    Jul 4, 2005
    Messages:
    40
    Alex,

    Before I try this, will this affect any future upgrades when the next release comes out. Is this due to be soon by the way or a long way off?

    Best wishes,

    David
  6. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    David,
    if upgrade will touch signup.php or signup.html you will have to repeat changes described above.
  7. dmsid

    dmsid New Member

    Joined:
    Feb 8, 2006
    Messages:
    1
    Add as an option in Admin

    Do you think that this could be added as an option in a future version. You could select in the setup or in the admin to have people us their email address as their login?

    All the best,
    -Jon
  8. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Unfortunately, this will create problems with integration plugins, so we don't plan to make this "official" option.
  9. swalls

    swalls New Member

    Joined:
    Mar 9, 2006
    Messages:
    1
    Email as Login name

    Alex,

    FYI - I am also wanting to use the email as the username.
    For me as a pre-purchaser, this is important.

    I appreciate the fact that it can be worked around, but reapplying the workaround after upgrades is very annoying and error prone.

    Thanks,
    Scott
  10. will

    will Guest

    I tried this but when signing up I get this error:

    "Username contains invalid characters - please use digits, letters or spaces"

    Perhaps the @ symbol or the "." is tripping it up? How can those be added as an allowed character?


    EDIT:
    Nevermind, I added a period to this line:

    Code:
    if (preg_match('/[^0-9a-zA-Z@_ ]+/', $vars['login'])){ 
    
    so it became

    Code:
    [if (preg_match('/[^0-9a-zA-Z@_. ]+/', $vars['login'])){ ]
    
    Everything works now.
  11. michael_51

    michael_51 New Member

    Joined:
    Aug 22, 2006
    Messages:
    2
    I get an error:

    Parse error: parse error, unexpected '[' in /var/www/web154/html/amember/signup.php on line 55
  12. michael_51

    michael_51 New Member

    Joined:
    Aug 22, 2006
    Messages:
    2
    Problem

    Does it works with amember 3.0.7..?
    I get error: WARNING: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 15 in line 59 of file signup.php

    email adress xxxxx@xxx-xxx.com

    Sign-up.php: if (preg_match('/[^0-9a-zA-Z@_.- ]+/', $vars['login'])){
  13. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    replace to
    PHP:
    if (preg_match('/[^0-9a-zA-Z@_ \.-]+/'$vars['login'])){
  14. kirkward

    kirkward New Member

    Joined:
    Feb 12, 2008
    Messages:
    15
    Alex,

    Can this be implemented with a single "include" to minimize the editing required when signup.php or signup.html are touched by an upgrade?

    Kirk

Share This Page