There is some strange behaviour for a comment-count achievements. I have created several achievements unlocking after typing several achievements (2,5,10) as in achievements.api.php was described. Just for a test. The strange thing is that when I am logged in as an Administrator - notification popup is displayed properly after entering X comments, but if to login as an user - such a popup is not displayed :( meanwhile the achievement appears to be unlocked well (same browser).
If to give an achievement to a user - such user will see the notification popup after page refresh.

Any ideas how to fix it?

P.S: Thx for a great work, you've made a great module!

Comments

morbus iff’s picture

I've not heard of this one - is your site accessible where I could make a test comment myself?

Have you confirmed if the achievement popup code is in the HTML source, but it's just not being rendered?

Valera Tumash’s picture

Have you confirmed if the achievement popup code is in the HTML source, but it's just not being rendered?

There is the following code in the page, where the popup should appear:

<div class="achievement-notification achievement-unlocked ui-corner-all element-hidden">
  <div class="achievement-image">
    <a href="/achievements/leaderboard/comment-count-2">
      <img typeof="foaf:Image" src="http://site.name/sites/all/modules/achievements/images/default-unlocked-70.jpg" alt="Posted 2 comments!" title="Posted 2 comments!" />
    </a>
</div>
is your site accessible where I could make a test comment myself?

Yes it is, I will send you all the neccesserry information via PM or Email.

Alse, here is my hook_comment_insert():

function mymodule_comment_insert($comment) {
  $current_count = achievements_storage_get('comment-count', $comment->uid) + 1;
  achievements_storage_set('comment-count', $current_count, $comment->uid);
  
  foreach (array(2,5,10) as $count) {
    if ($current_count == $count) {
      achievements_unlocked('comment-count-' . $count, $comment->uid);
    }
  }
}