xoops forums

fatman

Friend of XOOPS
Posted on: 2004/2/18 18:28
fatman
fatman (Show more)
Friend of XOOPS
Posts: 176
Since: 2003/12/13
#1

trying to stop comments adding to user post count

Hi, I'm hoping someone here knows a little about xoopscomments.php

around line 103 / 104 I find this
if ( $isnew != false 
{
$sql sprintf("UPDATE %s SET posts = posts+1 WHERE uid = %u",     $this->db->prefix("users"), $user_id);
if (!
$result $this->db->query($sql)) {
  echo 
"Could not update user posts.";
}
}


this is the only place where I can see comments adding to the user post count.

so I tried just adding $isnew = false; but that didn't work, so I tried commenting this entire block out, but the user post count still gets updated when someone is making a new comment.

Is there another location where this count gets updated that I'm missing?

my users are only going to get credit for contributing published articles.

brash

Friend of XOOPS
Posted on: 2004/2/18 21:51
brash
brash (Show more)
Friend of XOOPS
Posts: 2206
Since: 2003/4/10
#2

Re: trying to stop comments adding to user post count

I'm no coder, but what would happen if you set posts+1 to posts+0?

hsalazar

Just popping in
Posted on: 2004/2/19 2:14
hsalazar
hsalazar (Show more)
Just popping in
Posts: 78
Since: 2003/2/6 1
#3

Re: trying to stop comments adding to user post count

fatman:

First: is the posts count increasing because of posts in the forum module? Probably yes. If so, you can see in the file /modules/newbb/post.php, around line 176, code indicating that if the user is registered and there's a post, a call is made to the function incrementPost().

This function, which by the way is deprecated, can be found in the file /kernel/user.php, lines 162-165.

So the easy answer to your question could be: delete line 176 in /modules/newbb/post.php...

Try it and give us feedback. Did it work?

Cheers.

fatman

Friend of XOOPS
Posted on: 2004/2/19 18:01
fatman
fatman (Show more)
Friend of XOOPS
Posts: 176
Since: 2003/12/13
#4

stop comments adding to user post count, solved

I was able to stop comments from adding to user post count, but it appears this can't be simply done XOOPS wide. Stopping the count for comments in news module and forums is explained below.

For Forums: hsalazar, your suggestion worked great. It occured to me that in forums, a 'reply' isn't really a comment, but still I want to disable the post count for my site :)

Commenting out the function around line 176 of /modules/newbb/post.php
// $xoopsUser->incrementPost();


For stopping comments from adding to user post count in news your need to edit two files. /include/comment_post.php and /include/comment_delete.php

@ line 335 in comment_post.php
// before        
$member_handler->updateUserByField($poster'posts'$poster->getVar('posts') + 1);

// after change +1  to +0
$member_handler->updateUserByField($poster'posts'$poster->getVar('posts') + 0);



and arount line 152 in /include/comment_delete.php
// before            
$member_handler->updateUserByField($com_poster'posts'$com_poster->getVar('posts') - 1);

// after change -1 to -0
$member_handler->updateUserByField($com_poster'posts'$com_poster->getVar('posts') - 0);