I'm using the Achievements module to award the badges to users on certain actions.
In the following example user will get badges after posting 5 and 10 comments.
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(5,10) as $count) {
if ($current_count == $count) {
achievements_unlocked('comment-count-' . $count, $comment->uid);
}
}
}
The above code is working, user is able to achieve badge after posting 5 comments but since the comment form is being submitted through AJAX, the rewarded achievements notification popup is not being shown until page refresh.
So how can I show achievement notification popup for Ajax callbacks? Any suggestions?