1

Topic: Reseting post count

So on a PunBB install... I reset a user's post count as a joke.  He was at about 70ish and I set him to 10001 via the user profile (as seen when logged in as an Admin).  Now how to do I set him back to his actual count?  He should be around 80 or 90 now, but I accidentally reset him back to 0, so he's only listed as having a couple of posts. sad

Any way to do this easily?

Re: Reseting post count

Go to his profile and change it tongue

3

Re: Reseting post count

So basically, if I want to be accurate, I have to count up his posts and just put that as the starting number?

D'oh! big_smile (I was hoping there was a "switch back to actual count" option somewhere)

Re: Reseting post count

Just put in 80 or something tongue

5

Re: Reseting post count

Ah, got it!  I did a search by author, listed results as posts, and just counted 'em up.

Cool.

Now I just hope it continues to count up from the 101 he has when he makes new posts. wink

Re: Reseting post count

Yeah it will smile

7 (edited by Smartys 2006-06-14 21:18)

Re: Reseting post count

I actually wrote a plugin to do this a little while back (for everyone in the forums though), lets see if it is somewhere...
Aha, yes, I have a copy I can get to (I don't know why I didn't release it)

8

Re: Reseting post count

Smartys wrote:

I actually wrote a plugin to do this a little while back (for everyone in the forums though), lets see if it is somewhere...
Aha, yes, I have a copy I can get to (I don't know why I didn't release it)

eww, sry for pulling up this old thread, but i wonder where i can find your plugin for post count reseting hmm

Re: Reseting post count

Just run the following SQL query:

update prefix users set num_posts=(select count(id) from prefixposts where poster_id=prefixusers.id) where id > 1

where prefix is your database prefix

Re: Reseting post count

Providing you're using MySQL 5.

Re: Reseting post count

Are you sure? I think that would work in 4.1 as well

Re: Reseting post count

Possibly, depends on when subqueries where introduced, but I think it was MySQL 5.

Re: Reseting post count

http://dev.mysql.com/doc/refman/4.1/en/subqueries.html

Re: Reseting post count

Ah, all the better smile

15 (edited by AppeL 2007-08-02 21:39)

Re: Reseting post count

i replaced user_id with poster_id (because there was no user_id column in the posts table) and now all users have 0 posts -.-

it's MySQL 4.1.22

(i run the sql query directly in the phpmyadmin)

Re: Reseting post count

I modified the query, try it now

17

Re: Reseting post count

works wink
ill write an admin plugin for this maybe

would be my first

thx

18 (edited by AppeL 2007-08-18 14:33)

Re: Reseting post count

ok, here it is:

http://punbb.org/forums/viewtopic.php?pid=99478