Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Disable modules for a specif virtuemart shopper group

Disable modules for a specif virtuemart shopper group

Hi.
I want to show a module to all except a particular virtueMart shopper group.
So I tried the following

Code:

if ($user->usertype == "Registered") {

    $id = (int)$user->id;
    $query = "SELECT  shopper_group_id FROM #__vm_shopper_vendor_xref " . " WHERE user_id = '$id' and shopper_group_id = 7 ";
    $db->setQuery( $query, 0, 1 );
    $row = $db->loadObject();
    $groupid = $row->shopper_group_id;
if ($groupid == 7) {
$changes->mod(88)

     ->enable(false);

return 88;

}

I have the module 88 enabled in the module manager and listed inside the metaMod module page.

What's wrong?

francesco.r
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Disable modules for a specif virtuemart shopper group

Thanks to the previus answer by Stephen, I'm going to try something different


$vm = JomGenius("virtuemart"); // always put this line first
if ( $vm->check("shopper_group = 5") ) return true;

That will make the rule SUCCEED if the logged in user is in shopper group 5.

If you want to check for more than one group:

$vm = JomGenius("virtuemart"); // always put this line first
if ( $vm->check("shopper_group = 5, 7, 11") ) return true;

That will make the rule SUCCEED if the user is in groups 5, 7 or 11.

Note: this rule needs to go in the PHP box in the left column, NOT the PHP box in the SUCCEED or FAIL rules.

But I think the problem still remains...

francesco.r
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Disable modules for a specif virtuemart shopper group

Here it is the solution!

Code:


$vm = JomGenius("virtuemart");
if ( $vm->check("shopper_group = 7") ) {

$changes->mod(88)
     ->enable(false);
return 88;

}

Excellent! Thanks, Stephen

francesco.r
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1696
Total Polls:
6
Total Posts:
5941
Posts this week:
8
User Info:
 
Total Users:
5378
Newest User:
gary9131
Members Online:
0
Guests Online:
174

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked