i would like to count all comments a user made
Thats why i hacked your code a bit.
First i had to add a field jos_users.comments
then in comment.class.php i added the following
function setUser()
{
$database =& JFactory::getDBO();
/* also in post ! and notification */
$query = "SELECT * FROM jos_users WHERE id='".$this->_userid."' LIMIT 1";
$database->SetQuery($query);
$result = $database->loadAssocList();
if ($result) {
$user = $result[0];
$this->_usertype = $user['usertype'];
$this->_tname = $this->_use_name ? $user['name'] : $user['username'];
$this->_temail = $user['email'];
$this->_tcomments = $user['comments'];# added by zurli
}
}
and then more below i changed this
#Commentscounter edit by zurli
$this->_tcomments = $this->_tcomments+1;
$query = "
UPDATE jos_users SET
comments=$this->_tcomments
WHERE id=$userid";
$database->SetQuery($query);
$database->Query() or die(_JOOMLACOMMENT_EDITINGFAILED . "\n $query");
#End Commentscounter edit by zurli
$database->SetQuery("
INSERT INTO jos_comment
(contentid,component,ip,userid,usertype,date,name,email,website,notify,title,comment,published,voting_yes,voting_no,parentid)
VALUES(
'$this->_content_id',
'$com',
'$ip',
'$userid',
'',
'$createdate',
'$name',
'$email',
'$website',
'$notify',
'$title',
'$comment',
'$published',
'0',
'0',
'$parent_id'
)");
$result=$database->Query() or die(_JOOMLACOMMENT_SAVINGFAILED); //.$database->getQuery());
what you think about solution