Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Problem with K2 and add tag from site FE
(1 viewing) (1) Guest
Support forum for customers who have purchased JoomSEF 3 (Joomla 1.5 compatible). Archive only, no new post can be added.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1

TOPIC: Problem with K2 and add tag from site FE

Problem with K2 and add tag from site FE 15 years, 3 months ago #7927

I'm using K2 from joomlaworks and i have problem when try to add tags from joomla FE, i received every time "You need to enter a tag!" .
With JomSEF disable the problem is not present.
I think that the problem is on this piece of code that is present on /administrator/components/com_k2/models/tag.php, i think that the problem is on the red code


function addTag(){

global $mainframe;
$tag=JRequest::getString('tag');

$response = new JObject;
$response->set('name',$tag);


require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
$json=new Services_JSON;

if (empty($tag)){
$response->set('msg',JText::_('You need to enter a tag!',true));
echo $json->encode($response);
$mainframe->close();
}

$db = & JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__k2_tags WHERE name=".$db->Quote($tag);
$db->setQuery($query);
$result = $db->loadResult();

if ($result>0){
$response->set('msg',JText::_('Tag already exists!',true));
echo $json->encode($response);
$mainframe->close();
}

$row = & JTable::getInstance('K2Tag', 'Table');
$row->name=$tag;
$row->published=1;
$row->store();

$cache = & JFactory::getCache('com_k2');
$cache->clean();

$response->set('id', $row->id);
$response->set('status','success');
$response->set('msg', JText::_('Tag added!',true));
echo $json->encode($response);

$mainframe->close();

}



could you verify ?
The topic has been locked.
  • Page:
  • 1
User Login Empty