Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /**
  2. * Implements hook_achievements_info().
  3. */
  4. function ex_achievements_achievements_info() {
  5. for ($i = 1; $i <= 100; $i++) {
  6. $achievements['ex-comment-count-' . $i] = array(
  7. 'id' => 'ex-comment-count-' . $i,
  8. 'title' => t('Posted @i comments!', array('@i' => $i)),
  9. 'description' => t('You have successfully helped test the achievements.module. Heh.'),
  10. 'points' => $i,
  11. );
  12. }
  13.  
  14. return $achievements;
  15. }
  16.  
  17. /**
  18. * Implements hook_comment_insert().
  19. */
  20. function ex_achievements_comment_insert($comment) {
  21. $current_count = achievements_storage_get('ex-comment-count', $comment->uid) + 1;
  22. achievements_storage_set('ex-comment-count', $current_count, $comment->uid); // HAI
  23.  
  24. if ($current_count <= 100) {
  25. achievements_unlocked('ex-comment-count-' . $current_count);
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement