Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_achievements_info().
- */
- function ex_achievements_achievements_info() {
- for ($i = 1; $i <= 100; $i++) {
- $achievements['ex-comment-count-' . $i] = array(
- 'id' => 'ex-comment-count-' . $i,
- 'title' => t('Posted @i comments!', array('@i' => $i)),
- 'description' => t('You have successfully helped test the achievements.module. Heh.'),
- 'points' => $i,
- );
- }
- return $achievements;
- }
- /**
- * Implements hook_comment_insert().
- */
- function ex_achievements_comment_insert($comment) {
- $current_count = achievements_storage_get('ex-comment-count', $comment->uid) + 1;
- achievements_storage_set('ex-comment-count', $current_count, $comment->uid); // HAI
- if ($current_count <= 100) {
- achievements_unlocked('ex-comment-count-' . $current_count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement