We are running VM 2.0.6.
We have certain custom fields that we would like to display only for users in a certain group.
I know my syntax is completely wrong at this moment. I copied some stuff I found on the forums. I should pick up a book on php.
Perhaps someone else knows how to do this?
I already started to modify default_customfields.php:
First I check if a user is in the groups with id 3 or 5 and I add it to a variable. (code added to top of default_customfields.php)
function is_verdeler(){
$user =& JFactory::getUser();
$user_id = $user->get('id');
if(true){
//include inherited groups
jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($user_id);
}else{
//exclude inherited groups
$user =& JFactory::getUser($user_id);
$groups = isset($user->groups) ? $user->groups : array();
}
$return = 0;
if(in_array(3, $groups) OR in_array(5, $groups)){
$return = true;
}
return $return;
}
$isverdeler = $this->is_verdeler();
I would use the option admin only in the backend to mark fields which should be displayed for certain user groups only.
Then in default_customfields.php I would add a check beneath "if ($field->display) {..." to see if custom field should actually be displayed for the current user.
Anyone else who did this. Help would be greatly appreciated.
Nobody had to implement this before?
No, but interesting idea. You need of course the groups, the user is in.
Something like
$model = VmModel::getModel('users');
$user = $model->getCurrentUser();
if(in_array($user->virtuemart_shoppergroup_id,array(your shoppergroup ids))){
} else{
}
We overhaul the customfields for vm2.1. Yeyeh I talk since December about it. But this is an intersting idea to add.
Has this been implemented by any chance?
Bump...
The prices for shoppers are ok but the prices for the product options aren't adjusted by the tax and calculation rules for our distributors!
Nobody is in the same situation?