如何限制用户根据其邮政编码在Virtuemart中注册

时间:2014-09-11 20:14:23

标签: javascript php joomla2.5 virtuemart

我正在尝试找到一种方法来验证用户邮政编码,当他们注册前三个/四个字符时。我有本地公司,并希望限制用户注册。

我已经能够编辑大部分的PHP代码,但似乎无法找到引用该字段的位置。

它可能是由javascript控制的,在这种情况下,这可能是我不太了解它的原因!

希望你这样做:)

1 个答案:

答案 0 :(得分:2)

我设法让这个工作:

文件编辑:administrator\components\com_virtuemart\models\user.php

joomla 2.5 virtmart 2.66

//JASPAL'S POSTCODE HACK


$postcode = $user->get('zip');

if((false !== stripos($postcode, 'PC1')) OR (false !== stripos($postcode, 'PC2'))){
    $postcodematch =TRUE;
    }
else{
    $postcodematch =FALSE;
}

然后编辑:

    if ($new) {
        if ($postcodematch == TRUE) $this->sendRegistrationEmail($user,$user->password_clear, $doUserActivation);
        if ($postcodematch == FALSE)  $doUserActivation = TRUE;
        if ($doUserActivation ) {

            if ($postcodematch == TRUE) vmInfo('COM_VIRTUEMART_REG_COMPLETE_ACTIVATE');
            else{
                 vminfo($postcode);
                 vmInfo('Sorry we do not deliver in your area at the moment. We hope to be there soon and shall contact you.');
                 $doUserActivation = FALSE;
            }

限制用户的注册邮件。

希望这有助于其他人!