Keyword

Comments function [RISOLTO]

  • Alex Deidda
  • Alex Deidda's Avatar Topic Author
  • Offline
  • New Member
More
12 years 3 months ago - 12 years 3 months ago #101709 by Alex Deidda
Comments function [RISOLTO] was created by Alex Deidda
hi,

I am trying to add one function on Comments: the users can post only one comment on a Item, not more.

I don't think is hard to setup, but I cannot find the right way.

I need because I am improving the K2 to be used also like a kind of "Auction" extension.

Hope to have some suggestions.

Cheers,
Alex.

vorrei poter mettere un controllo che impedisce di postare piu' volte sullo stesso item

Please Log in or Create an account to join the conversation.

  • Alex Deidda
  • Alex Deidda's Avatar Topic Author
  • Offline
  • New Member
More
12 years 3 months ago - 12 years 3 months ago #101710 by Alex Deidda
Replied by Alex Deidda on topic Re: Comments function [RISOLTO]
Abilitare un solo commento per item agli utenti registrati

Aggiungere in:
components/com_k2/models/item.php

if ($item->published) {
$db = &JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__k2_comments WHERE itemID=".$item->id." AND userID=".$user->id;
$db->setQuery($query);
$result = $db->loadresult();
if ($result > 0) {
$response->message = JText::_('K2_ALREADY_BID', true);
echo $json->encode($response);
$mainframe->close();
}
}


Io l'ho messo sotto:
// check permission
linea 917

ma puo' essere messo altrove
Il controllo if($item->published) non e' necessario

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum