Support Forum

setting users post count?

MO mike olson
mike olson
Member

I tried doing a search for this but I am wondering if there is a way to set users post counts?Either through the interface or through the database?

 

I ask because I already set up simple press and I have everything that I want set up but I noticed that your converter tool will only work with a fresh install (converting from ip.board). I believe I can import a list of users into wordpress which should work to get my users set up but my users would like their post counts to remain the same. 

 

Thoughts?

11 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Forum Admin > Toolbox > Housekeeping. There is a task on that panel to recalc all users post counts. Is that what you need?

MO mike olson
mike olson
Member

No not exactly. Since my users will not have any posts I just want to set their post count to what it was on our old forums and have it continue on from there. So either I will have to set them manually or update whatever table that data is stored on. I guess I need to know what table that is and if there is a risk of corrupting anything by setting them manually.

YS Yellow Swordfish
Yellow Swordfish
Member

Ah sorry – I misunderstood. It has been one of those days!

A users forum post count is maintained in the sfmembers table in the column simply named ‘posts’. The table will require your set WP table prefix of course.

If you have a table with the data including user_id and post count then it could be updatred with a simple SQL query.

MO mike olson
mike olson
Member

Ok one last question. 

 

I know I can import users to the wp users table. Is there any reason that I can’t import users into the WP_SFMEMBERS table? I would want to import to the display_name and posts field. Is there any reason that importing just these two fields to the WP_SFMEMBERS table would cause issues? Are all other fields that are required set to default values? 

YS Yellow Swordfish
Yellow Swordfish
Member

Not realistically possible I am afraid.

Firstly the forum’s sfmembers table is intrinsically linked to the WP users and usermeta tables plus some of the columns in sfmembers do need code to fill them. There is a function that can be called to perform this task but it has to be called for each new sfmember row creation – most usually triggered by a new user creation in WP users.

MO mike olson
mike olson
Member

hmmm ok well how well does your import tool work? I hate that I have to redo all the permissioning as that was a big pain for me. But if that gets my users in with their post counts intact then that’s what I will have to do.

 

I can copy the additional css and the child theme folder to make it a bit less painful but wish I didn’t have to go back to a fresh install to import the data.  

YS Yellow Swordfish
Yellow Swordfish
Member

I wouldn’t want to do that either.

So this data came from a different forum. If you have the database still why not extract just the post count data and import that separately? Do you have tools to run queries on your database? And do you know the table and column where the users posts are stored?

MO mike olson
mike olson
Member

Yellow Swordfish said
I wouldn’t want to do that either.

So this data came from a different forum. If you have the database still why not extract just the post count data and import that separately? Do you have tools to run queries on your database? And do you know the table and column where the users posts are stored?  

yes I still have the database. The problem is that the the users do not exist in the database. 

 

I went ahead and built a tool that will query the old database and the new wp_sfmembers table and then update the posts field to merge the two counts together. I will just have them check in with me as the log in and then I will run that tool and update them as they start to check in. I have 709 users right now so it is just going to be a bit of work but it won’t all be at once. 

MP Mr Papa
Mr Papa
Member

sorry, late to the game, but if the users are not in the database, then they wont be associated with existing posts… so in addition to creating the user post count, do you need/want to associate them with their old posts?

MO mike olson
mike olson
Member

Mr Papa said
sorry, late to the game, but if the users are not in the database, then they wont be associated with existing posts… so in addition to creating the user post count, do you need/want to associate them with their old posts?  

Thanks for the follow up. I think what I will do is update their post counts once they have registered. I’ve created a sticky post asking them to check in once they’ve registered. I then built a tool that will query the old database to get their old post count and then update their new post count in wp_sfmembers. Not ideal but it should get the job done. 

YS Yellow Swordfish
Yellow Swordfish
Member

If you can extract all users post counts into a table then the sfmembers table could be updated in one go for everybody with a simple update query…