w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to restrict users from registering in Virtuemart based on their postcode

I managed to get this to work by:

file edited: administratorcomponentscom_virtuemartmodelsuser.php

joomla 2.5 virtuemart 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;
}

then editing:

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

to restrict the user's registration mail.

hope this helps somebody else!





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.