[FIX] K2 Error: “The Name or Email Address you typed is already in use!”

Rate this item
(0 votes)
Tuesday, 26 March 2013 10:03;
Published in Joomla Tutorials;

We were doing a quality test of this new Joomla Tutorials Blog, which is done using JoomlaWorks K2 and we found a weird problem with it. When a guest tries to leave a comment, he cant do it. K2 throws an error, "The Name or Email Address you typed is already in use!".

 

The error is quite pointless, and we had to waste hours to debug and fix this. And here is how we fixed it. 

 

Goto components/com_k2/models/item.php and open it using a code editor. 

Find this code :

 if ($user->guest)
   {
    $db = JFactory::getDBO();
    $query = "SELECT COUNT(*) FROM #__users WHERE name=".$db->Quote($userName)." OR email=".$db->Quote($commentEmail);
    $db->setQuery($query);
    $result = $db->loadresult();
    if ($result > 0)
    {
     $response->message = JText::_('K2_THE_NAME_OR_EMAIL_ADDRESS_YOU_TYPED_IS_ALREADY_IN_USE');
     echo $json->encode($response);
     $mainframe->close();
    }

   }

 

Replace it with this code :

 /*if ($user->guest)
   {
    $db = JFactory::getDBO();
    $query = "SELECT COUNT(*) FROM #__users WHERE name=".$db->Quote($userName)." OR email=".$db->Quote($commentEmail);
    $db->setQuery($query);
    $result = $db->loadresult();
    if ($result > 0)
    {
     $response->message = JText::_('K2_THE_NAME_OR_EMAIL_ADDRESS_YOU_TYPED_IS_ALREADY_IN_USE');
     echo $json->encode($response);
     $mainframe->close();
    }

   }*/

REQUEST A QUOTE CONTACT US

Read 2210 times Last modified on Thursday, 16 May 2013 10:21
comments powered by Disqus

We are on Facebook

Tutorials Search