2011-10-13 74 views
0

我不想編輯由sfForkedDoctrineApplyPlugin創建的用戶/設置頁面。 我找不到任何有用的東西。或者是否有辦法完全禁用用戶/設置並使用這些方法來設置具有自定義配置文件頁面的新mailaddress?編輯sfForkedDoctrineApplyPlugin用戶/設置

編輯:目前sfForkedDoctrineApplyPlugin的用戶/設置形式只允許我修改名字和姓氏。我不想編輯它,或者創建(我更喜歡)我自己的自定義用戶設置頁面,並使用更改電子郵件地址的方法,這些方法已經內置了sfForkedDoctrineApplyPlugin。

回答

0

檢查文件:sfApplySettingsForm.class.php 有:

class sfApplySettingsForm extends sfGuardUserProfileForm 
{ 
    public function configure() 
    { 
    parent::configure(); 
    $this->removeFields(); 

    // We're editing the user who is logged in. It is not appropriate 
    // for the user to get to pick somebody else's userid, or change 
    // the validate field which is part of how their account is 
    // verified by email. Also, users cannot change their email 
    // addresses as they are our only verified connection to the user. 

    $this->widgetSchema->setLabels(
      array(
       'firstname' => 'First Name', 
       'lastname' => 'Last name')); 
    $this->widgetSchema->moveField('firstname', sfWidgetFormSchema::FIRST); 
    $this->widgetSchema->moveField('lastname', sfWidgetFormSchema::AFTER, 'firstname'); 

    $this->widgetSchema->setNameFormat('sfApplySettings[%s]'); 
    $this->widgetSchema->setFormFormatterName('list'); 

    $this->setValidator('firstname' , new sfValidatorApplyFirstname()); 
    $this->setValidator('lastname', new sfValidatorApplyLastname()); 



    } 

    protected function removeFields() 
    { 
    unset(
     $this['user_id'], 
     $this['validate'], 
     $this['email'], 
     $this['email_new'], 
     $this['validate_at'], 
     $this['id'], 
     $this['created_at'], 
     $this['updated_at'] 
    ); 
    } 
}