1
fatman
trying to stop comments adding to user post count
  • 2004/2/18 18:28

  • fatman

  • Friend of XOOPS

  • Posts: 176

  • Since: 2003/12/13


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.

2
brash
Re: trying to stop comments adding to user post count
  • 2004/2/18 21:51

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


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

3
hsalazar
Re: trying to stop comments adding to user post count
  • 2004/2/19 2:14

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


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.

4
fatman
stop comments adding to user post count, solved
  • 2004/2/19 18:01

  • fatman

  • Friend of XOOPS

  • Posts: 176

  • Since: 2003/12/13


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);



Login

Who's Online

384 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 384


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits