Changing username to email on forgot password

Discussion in 'aMember Pro v.4' started by gogoseo, Mar 1, 2013.

  1. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Hello,

    i use email addresses instead of usernames. So i replaced every accourance of username on site. The exception is the form that is displayed when the users forgot their password->enter their email on form->receive the forgot pass email->follow the link in email and the amember/sendpass/ site opens.

    On this site the first field is an uneditable "Username" field. How can i change that field so that it displays the "Email".
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You have to edit /amember/application/controllers/Sendpasscontroller.php
    In that file find function createForm and remove this line:

    $form->addElement('text', 'login', array('disabled'=>'disabled'))
    ->setLabel(___('Username'));
  3. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Thanks. And how would i display the user email address instead of username?
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Change above line to:
    PHP:
    $form->addElement('text''email', array('disabled'=>'disabled'))
    ->
    setLabel(___('Email'));
    Then change this block :
    PHP:
                $form->setDataSources(array(
                    new 
    HTML_QuickForm2_DataSource_Array(array(
                            
    self::SECURITY_VAR=>$this->_request->get(self::SECURITY_VAR),
                            
    'login'=>$this->user->login
                        
    ))
                ));
    to

    PHP:
                $form->setDataSources(array(
                    new 
    HTML_QuickForm2_DataSource_Array(array(
                            
    self::SECURITY_VAR=>$this->_request->get(self::SECURITY_VAR),
                            
    'email'=>$this->user->email
                        
    ))
                ));

Share This Page