Previous Thread
Next Thread
Print Thread
Hop To
Anonymous
Unregistered
Anonymous
Unregistered
I am a very experienced perl programmer, yet I have not had the time to drudge through a lot of the UBB code. Can anyone give me any hints as to how I would go about decrementing a user's post count when one of their posts is deleted or a topic is deleted containing multiple posts from that user?

As best I can tell, the code needed would be inserted in ubb_edit_post.cgi, but I'm not sure how UBB handles storing posts and users in memory, and in what structures or under what variables they are stored.
Thanks

Anonymous
Unregistered
Anonymous
Unregistered
The user post count is stored in two places - in line 8 (index 7) of each user profile, and in the pc_index.cgi file in 6.4.0 and higher.

You should use GetPCdexAsHash and UpdatePCdex from lib_files to twiddle the pc_index... examples are available in the directory area of ubb_profile.cgi and the member rebuilding bits of cp_users. Modifying the user file is a simple OpenProfile/WriteMemberProfile affair... there are plenty of examples in the code.

However, I question your sanity a bit - one of the reasons we don't decrease user post counts is due to the potential load of removing a topic with a few dozen unique posters... though it shouldn't be a problem unless nuking entire topics will be somewhat common.

Always remeber that you can get a count of the user's current posts by counting the lines in the user post history file (members/user_posts/00000000.cgi), though that isn't a low load operation either...

--
Charles Capps
UBB.classic™ Developer
Having problems? Open up a support ticket!

Anonymous
Unregistered
Anonymous
Unregistered
Thank you very much, that should help quite a bit. The reason I am doing this is because certain parts of a site I opertate (which uses ubb.classic) rely on user post count to allow access to certain restricted areas. I wrote a set of perl modules which provide an interface to authenticate users and to get user information from UBB. Unfortunately, this makes it possible for users to spam their way into parts of the site, and moderator deletion has no effect.

Anonymous
Unregistered
Anonymous
Unregistered
Penalty of -50 posts off their post record for spamming does wonders to curb spam messages. I've started to enforce that rule 2 years ago and there practically haven't been spam posts to speak of any more. Though, of course, I also couple that with a hack which prevents a user to reply to his own post until someone else does...

-----------------
Need your UBB.classic installed, upgraded or moved to a new server by an experienced admin? Want hacks installed by someone who knows what he's doing? Need any scripts installed? PM or e-mail me!


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
2 members (Ruben, 1 invisible), 998 guests, and 205 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)