News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Administrator not receiving emails when new user register through virtuemart

Started by Nagaraj, January 23, 2014, 10:11:50 AM

Previous topic - Next topic

Nagaraj

Hi All,

I am using virtuemart registration page in my joomla2.5.17 website and using virtuemart version 2.0.26. I have selected New user Account activation as "Admin" in  Users Configuration options, enabled the option Receive System emails as yes. But I didn't get the new user registration emails but user getting activation link.
When I was searching in code for the functionality in /administrator/components/com_virtuemart/models/user.php few lines were commented out why this lines commented.  Line Numbers 1293 to 1297 and written query as
$query = 'SELECT name, email, sendEmail' .
            ' FROM #__users' .
            ' WHERE LOWER( usertype ) = "super administrator"';
In joomla2.5 usertype is not like "super administrator" then why the query written like this?
The following is the code in virtuemart user.php model

private function sendRegistrationEmail($user, $password, $doUserActivation){
      if(!class_exists('shopFunctionsF')) require(JPATH_VM_SITE.DS.'helpers'.DS.'shopfunctionsf.php');
      $vars = array('user' => $user);

      // Send registration confirmation mail

      $password = preg_replace('/[\x00-\x1F\x7F]/', '', $password); //Disallow control chars in the email
      $vars['password'] = $password;

      if ($doUserActivation) {
         jimport('joomla.user.helper');
         if(JVM_VERSION === 2) {
            $com_users = 'com_users';
            $activationLink = 'index.php?option='.$com_users.'&task=registration.activate&token='.$user->get('activation');
         } else {
            $com_users = 'com_user';
            $activationLink = 'index.php?option='.$com_users.'&task=activate&activation='.$user->get('activation');
         }
         $vars['activationLink'] = $activationLink;
      }
      $vars['doVendor']=true;
      // public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null)
      shopFunctionsF::renderMail('user', $user->get('email'), $vars);

      //get all super administrator
      $query = 'SELECT name, email, sendEmail' .
            ' FROM #__users' .
            ' WHERE LOWER( usertype ) = "super administrator"';
      $this->_db->setQuery( $query );
      $rows = $this->_db->loadObjectList();

      $vars['doVendor']=false;
      // get superadministrators id
      foreach ( $rows as $row )
      {
         if ($row->sendEmail)
         {
            //$message2 = sprintf ( JText::_( 'COM_VIRTUEMART_SEND_MSG_ADMIN' ), $row->name, $sitename, $name, $email, $username);
            //$message2 = html_entity_decode($message2, ENT_QUOTES);
            //JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
            //shopFunctionsF::renderMail('user', $row->email, $vars);
         }
      }


   }


Please review the above code and clarify.


Thanks Advance

sohopros

This is still an open question - is there anyone that can help us with this?

rizecorp

Can Anybody provide suggestions for original post.

Thanks in advance.

GJC Web Design

Why it is like this I assume is because it isn't recommended to have account activation in the shop.
It is hard to imagine a cart being completed if the visitor had to wait on an admin to authenticate them!

As the code stands it will never send to an admin as on line 626 the config is read

if ($useractivation == '1' or $useractivation == '2') {
               $doUserActivation=true;
            }

but that just sets the $doUserActivation to true - but doesn't pass which type of activation

if you really wanted to approve registrations as an admin surely it's simpler to get them to first register with Joomla?

If not do something like pass the 1 or 2 to $doUserActivation and use that in the sendRegistrationEmail() function to choose who to send the email to
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation