所以,我知道如何将字段添加到表单中,我只是不能让它获取秘密代码并对其进行评估。
我认为在此过程中必不可少的文件:
/components/com_users/views/registration/tmpl/default.php
/components/com_users/controllers/registration.php
/components/com_users/models/registration.php
/components/com_users/models/forms/registration.xml
如果我没弄错的话,我只需要找出在哪里放
if( $data['secretcode'] != 'code phrase') {
return false;
}
在/components/com_users/models/registration.php文件中
我添加了
// Secret Code Validation
$secretcode = JRequest::getVar('secretcode', '', 'post', 'string');
$secretcode2 = 'password';
$secretcode3 = 'Password';
if ( $secretcode==$secretcode2 ) {
return true;
} elseif ( $secretcode==$secretcode3 ) {
return true;
} else {
// Redirect back to the registration screen.
$this->setMessage('Invalid Secret Code', 'warning');
$this->setRedirect(JRoute::_('/register/', false));
return false;
}