Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: t3h ub3r k1tten on July 30, 2007, 02:35:35 AM

Title: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on July 30, 2007, 02:35:35 AM
This is a simple check to see if you are below 50 posts or 5 karma to be able to smite someone.
Made this mostly for a friends forum but I also use it on mine.
Reason for it is because noobs kept coming to the forum, asking questions that have been answered in at least 15 tutorials in the tutorials board, (sometimes in the wrong forums or ironically in the tutorial board itself), and then one users come and get mad at them they get mad and smite anyone who doesn't help them.
This caused a lot of trouble with users getting in karma fights and warring by smiting each other. -.- (left some users with -20 karma :P)
So, made this to stop the turmoil because new members can't smite, after my friend neglected to write it himself even though he supported the idea. :P

Enough of my rambling:
Edit file: Source/Karma.php
Find this:   
// Delete any older items from the log. (karmaWaitTime is by hour.)
db_query("
DELETE FROM {$db_prefix}log_karma
WHERE " . time() . " - logTime > " . (int) ($modSettings['karmaWaitTime'] * 3600), __FILE__, __LINE__);

And add this after it:
// Karma smite block, can't smite if under 50 posts or 5 karma, unless administrator
//  This might have been better to put in Load.php in the context['user']['karma']['allow'], but this is stabler between versions ;)
// By: T3h Ub3r K1tten - [email protected]
if(!allowedTo('moderate_forum') && // Admin check
($user_info['posts'] < 50 || // Post check, change 50 to minimum posts
($context['user']['karma']['good'] - $context['user']['karma']['bad']) < 5 )) { // Karma check, change 5 to minimum karma
fatal_error('You need a minimum of 50 posts or 5 karma to smite someone.', false); // Change this according to above, and maybe translate for mulitlang forums
}

And when they don't have sufficient posts/karma they'll see this:
(http://ub3rk1tten.com/site/plogger/images/forum_images/random_stuff/errorminkarma.bmp)

So, post if you use, and anyone wanting to make this into a mod is free to do so, as long as you email me first. ;) [email protected]
Title: Re: Minimum posts/karma to smite user
Post by: 青山 素子 on July 30, 2007, 11:17:15 AM
Although you can't restrict by how much karma a user has in SMF currently, you can accomplish the 50 post minimum. In the Karma area of Features and Options, there is a "minimum posts needed to modify karma" setting that you can fill in.
Title: Re: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on July 30, 2007, 05:12:10 PM
Thats modify, which covers applauding too, this is smite. ;)
This helps so new users can applaud for tutorials/etc. but can't abuse smite.
Title: Re: Minimum posts/karma to smite user
Post by: 青山 素子 on July 30, 2007, 05:51:54 PM
Ah, interesting idea.

If I get the time, would you mind if I use your code to make a configurable mod for this?
Title: Re: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on July 30, 2007, 07:22:46 PM
Feel free. :)
Title: Re: Minimum posts/karma to smite user
Post by: Joshua Dickerson on July 30, 2007, 11:57:51 PM
Can someone confirm that this works? I want to add it to the tips/tricks board.
Title: Re: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on July 31, 2007, 01:54:42 AM
Well if my test smf counts, I put it on there: http://ub3rk1tten.com/smftest/
Title: Re: Minimum posts/karma to smite user
Post by: Joshua Dickerson on July 31, 2007, 01:58:37 AM
Good enough for me. Now, do you want to package it up? ;)
Title: Re: Minimum posts/karma to smite user
Post by: pirat3 on July 31, 2007, 04:37:45 PM
Quote from: groundup on July 31, 2007, 01:58:37 AM
Good enough for me. Now, do you want to package it up? ;)

Can you pm me o rreply back in this thread when you package it up, I am DYING to get this mod!!! +love to you bro!
Title: Re: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on July 31, 2007, 08:55:06 PM
I don't want to package it, because I've never made a real mod, but anyone else is welcome to. :)
Title: Re: Minimum posts/karma to smite user
Post by: pirat3 on August 11, 2007, 06:51:21 PM
This does not work on 1.1.2 (not sure of 113), but MEMBERS cannot smite or applaud, they get the message regardless and regardless of post# and karma ammount.
Title: Re: Minimum posts/karma to smite user
Post by: t3h ub3r k1tten on August 14, 2007, 03:46:49 PM
Oops looks like I forgot to make it smite only, not sure how I missed that :P but you might have put it in the wrong place.
Title: Re: Minimum posts/karma to smite user
Post by: S3NTYN3L on December 19, 2007, 06:08:37 AM
So, has anyone tested this out with 1.1.4?

Did you correct the code ub3r k1tten?
Title: Re: Minimum posts/karma to smite user
Post by: Fiery on January 09, 2008, 01:02:14 AM
Was anyone able to get this to work for 1.1.4?

Title: Re: Minimum posts/karma to smite user
Post by: Jalkson on January 10, 2008, 05:43:21 PM
Nice mod, thank you.