Hi,
This modification gave me a lot of headaches so I will much appreciate if someone can help me.
I want to create a shopper field (checkbox, lets name it "Don't activate me and don't send me email) that will be displayed in the registration form and
if the user check this when creates a new account, will not be activated so he will need to wait until one administrator activate him.
Thank you,
as your wanting to alter Joomla config settings not really a VM question
I would guess a user plugin and either onUserAfterSave($user, $isnew, $success, $msg) or onUserBeforeSave($user, $isnew, $success, $msg)
Hi,
Thank you for your reply. I've seen this can be also done through VM shopper edit.
Basically what I would like to do is when a user register to virtuemart and check a userfield (checkbox) to be blocked or not activated.
or... what will also help me is:
if ($shoppergroup == 37113756 ) {
block user code;
Thank you,
if u don't want to build a plugin you need to hack
somewhere in public function store(&$data){ in the user.php model
Hi,
I manage to solve this but by shoppergroup because I don't know how to get or echo values from shopper fields...
Anyway it does exactly what I needed. Here is the code:
<?php
// Get user id and shoppergroup
$user =& JFactory::getUser();
$userId = $user->get('id');
$db = JFactory::getDbo();
$query = 'SELECT `virtuemart_shoppergroup_id` ' . ' FROM `#__virtuemart_vmuser_shoppergroups` ' . ' WHERE `virtuemart_user_id` =' . $userId;
$db->setQuery($query);
$shoppergroup = $db->loadResult();
// Disable user if shoppergroup =
if ($shoppergroup == 1221746709 ) {
$database =& JFactory::getDBO();
$sql = "UPDATE `rk21a_users` SET `block` = '1' WHERE `rk21a_users`.`id` = $userId";
$database->setQuery($sql);
$database->query();
// Sign out the user
$app = JFactory::getApplication();
$user = JFactory::getUser();
$user_id = $user->get('id');
$app->logout($user_id, array());
// Display a message for user
echo '<div class="alert alert-notice">';
echo vmText::_ ('not good');
echo '</div>';
} else
?>