Support » Plugin: Achievements for WordPress » Multiple Karma Points Possible

  • I have managed to create a way of adding multiple karma points for repetitive actions.

    My main problem was that it does not award points for ‘every time’ certain actions are done.

    So I’ve had to make some changes though to get it to do what I really wanted. I’ve created another plugin to run along beside it as I didn’t want to edit the main plugin itself.

    It took quite a while to create (plus sweat, nearly blood and tears) but now I can grant multiple Karma points for …

    – Signing up (only given once)

    – Points for sending a message to other users on BP

    – If a user creates a post, I award them points every time they do so (Going to change this so they get the post creation points only if their post is read. Stops them creating random posts willy-nilly to get points.)

    – If their post gets read, they are awarded points for that
    (Going to show how many points the user has at the bottom of their pages/posts.)

    – If user deletes post, they lose points. (Working on this so if they delete it after 2 weeks, they won’t lose points. Should be easy to code.)

    – They get points for logging in daily. They only get it once that day, not every time they login. The next day, it resets and they can get points for logging in again. So the points are only given once a day no matter how many times they login that day.

    – They also get points for reading others users posts and pages.
    I’ve made sure though that if this happens I have checks in that confirms ..
    – The user is not admin so i give no points when checking posts
    – I set a 4hr cookie so they can’t keep coming back to rack up points
    – make sure they have a browser so I know they ain’t a BOT
    – Make sure the user/reader and the author are not the same
    – make sure that related posts don’t run the code when shown on the same page

    To do.
    Give multiple karma points for …

    – To the author when users comment on their post.

    – To the author when people viewing their topic in the forum.

    – To the author when users add to their thread in the forum.

    – A table showing the best pages and posts. Similar to karma points widget.

    – Archiving points every month and starting afresh.

    – If their post is shown no love or comments after 50 reads, it loses them points

    So still got a lot of work to do.

    The Achievements plugin is great if you want to award points for reaching a milestone in doing some task multiple times and I have that setup as well, but if you want to award points for doing something every time, this does not do it. Thats why I created a plugin to work along side the Achievements plugin.

    Any questions, Im on [ redacted, support is not offered via email, Skype, IM etc. only in the forums ]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jan Dembowski


    Forum Moderator and Brute Squad

    Sorry, but are you seeking support from the author of the plugin or considering submitting your own fork?

    Just putting the word out there that its possible to give multiple points.

    If anyone is interested, I can share the code for the logging in points and registration points.

    @ Sim2K I’m really interested by the code for the login and registration (i know that fort the registration points there was a bug in the plugin.. did you managed to find a solution ?

    Thank you in advance !

    Create a new plugin or add to functions file ….

    Registration points ….

    function new_user_setup($user_id)
        global $wpdb;
        //Set welcome points to be 99 karma points
        $Points_Add_Register = 99;
        //user info
        $user = get_userdata($user_id);
        //Give the new member 99 points
        update_user_meta($user_id, "jrp__dpa_points", Points_Add_Register);
    add_action("user_register", "new_user_setup");

    Login points ….

    function login_points($user_login, $user) {
                //20 points a day for logging in.
                $Points_Login = 20;
                //Set welcome points to be 99 karma points
                $Points_Add_Register = 99;
                //Get logged in user ID
                $user_id2 = get_userdatabylogin($user_login);
                $user_id = $user_id2->ID;
                $timeStamp = get_user_meta($user_id, "sim2k_ach_login", true);//When they last logged in.
                $timeStamp2 = date('Ymd');
        //see if the date they logged in is today and if they are admin with usr ID 1. If so its a no go!
        if ( $timeStamp != $timeStamp2 && $user_id != 1 ){
            $user_point_count = get_user_meta($user_id, "jrp__dpa_points", true);//Get the users points
                    // && $user_id != 0 - might not be needed but i got it in anyway
                    if(!$user_point_count && $user_id != 0)
                        //need to set points to 99 for registering if they have already registerd a while back
                        update_user_meta($user_id, "jrp__dpa_points", $Points_Add_Register);
                        $user_point_count = get_user_meta($user_id, "jrp__dpa_points", true);
            //Update user for logging in
            $user_point_count = $user_point_count + $Points_Login;
            update_user_meta($user_id, "jrp__dpa_points", $user_point_count);
            //Update the last time they logged in
            update_user_meta($user_id, "sim2k_ach_login", $timeStamp2);
    add_action('wp_login', 'login_points', 999, 2);

    Swap “jrp_” for your table prefix. Hope its not wp_ as thats a security issue.

    Hi, thanks for the codes, I will try it.
    But does this already work for giving multiple karma points?

    I mean, I have an achievement for making one comment, but I want to keep track points they earn for each comment until the 20th comment. My idea is give an award for doing the 20th comment and another for receiving the 20th point.

    Is it possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple Karma Points Possible’ is closed to new replies.