drj58429 2011-11-20 08:17
浏览 45
已采纳

Joomla 1.6添加字段到注册,需要特定代码才能通过

So, I know how to add the field into the form I just can't get it to take the secret code and evaluate it.

Files that I understand to be essential in doing this:

/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 I'm not mistaken all I need to find out is where to drop a

if( $data['secretcode'] != 'code phrase') {

  return false;

}
  • 写回答

1条回答 默认 最新

  • dskld5423 2011-11-26 21:15
    关注

    In the /components/com_users/models/registration.php file,

    I added

        // 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;
        }
    

    right above the form validation.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思