Example #1
0
function mp_get_total_points_by_userid($userid, $categoryid)
{
    return mp_get_activity_points_by_userid($userid, $categoryid) + mp_get_participation_points_by_userid($userid, $categoryid) + mp_get_contribution_points_by_userid($userid, $categoryid);
}
            $body .= sprintf("It has been %s days since you last posted a question.\n", mp_get_days_since_last_post($user['userid'], $category, 'Q'));
        } else {
            $body .= sprintf("You have not posted a question before.  Posting a question will help increase your activity points while motivating the knowledge sharing process.\n\n");
        }
        $answercount = mp_get_count_posts_by_userid_category_posttype($user['userid'], $category, 'A');
        if ($answercount > 0) {
            $body .= sprintf("You have posted %d answers so far. ", $answercount);
            $body .= sprintf("It has been %d days since you last posted an answer.\n", mp_get_days_since_last_post($user['userid'], $category, 'A'));
        } else {
            $body .= sprintf("You have not posted an answer before.  Posting an answer will help increase your activity and knowledge sharing points while helping your fellow students.\n\n");
        }
        // point awareness
        $body .= sprintf("\nPOINTS INFORMATION\n");
        $body .= sprintf("You currently have %6s activity points.\n", mp_get_activity_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s knowledge contribution points.\n", mp_get_contribution_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s participation points.\n", mp_get_participation_points_by_userid($user['userid'], $category));
        $body .= sprintf("You currently have %6s total points.\n\n", mp_get_total_points_by_userid($user['userid'], $category));
        // contribution
        //$body.= "Within last month, a total of X questions were asked. Of those questions, X were asked by you.  Of those question N were answered.<br />";
        //$body.= "Maybe you can help by answered those questions.<br />";
        $body .= sprintf("You can increase your points by logging in to the system, asking questions, posting answers, or voting for either a question or an answer.\n\n");
        $body .= sprintf("Sincerely,\nThe MicroProbe team");
        // send the mail to the user
        //qa_send_notification($user['userid'], null, null, $subject, $body, null);
        if ($debug == FALSE) {
            qa_send_notification($user['userid'], null, null, $subjects[$subjectindex] . $categoryinfo['title'], $body, null);
            //qa_send_notification(1, null, null, $subjects[$subjectindex].$categoryinfo['title'], $body, null);
        }
        echo $debug . '<hr>' . $body;
    }
}