builtin "Photogenic" badge not applied.

  • 166 Views
  • Last Post 12 September 2017
Arcitectus posted this 28 August 2015

I have set up a forum using v1.6.

I noticed that for multiple new users on that forum their profile shows:

+a profile picture different from the default one.

+not the Photogenic badge.

+no points awarded.

 

There is another user which already has the Photogenic badge on his profile page and has been awarded the badge points.

I have restarted the IIS application which hosts that forum and then requested the profile pages again but that did not seem to make any difference.

 

Is there a workaround to trigger recalculating the badges?

Has this been fixed in 1.7 (I am aware that 1.7 is not released yet)?

 

Order By: Standard | Newest | Votes
YodasMyDad posted this 28 August 2015

They must have updated their profile AND uploaded an image as their profile image (Not used gravatar for a custom image), the badge is definitely working as long as it's showing in your list of badges on the badges page.

  • Liked by
  • Arcitectus
Arcitectus posted this 28 August 2015

I do not yet understand what "updated their profile" means in this context. When I first posted I thought that happens when a user hits the "save" button in the "Edit Profile" view. Now I understand that this is not sufficient. Is posting also required?

The "Activity" view shows multiple "has an updated profile" entries for one of the users from the set I described earlier. Looking at the MembershipUser row of that same user I see that Avatar != NULL (is that sufficient to rule out the gravatar case?)  and also Location != NULL.

YodasMyDad posted this 28 August 2015

The badge is only awarded when they upload a new photo and save their profile. It does not take into account Gravatar.

JamKay posted this 09 July 2016

The badge award seems to require some time to pass or maybe it requires a logoff/logon.

 

I wondered about the same thing but the badge appeared the next day.

YodasMyDad posted this 14 July 2016

Badges are not applied straight away. It doesn't require you to logoff. It will get applied.

siaonong posted this 11 September 2017

I found the reason why that "Photogenic" badge didn't applied straight away.
It's because the ProfileBadgeCheck() in BadgeController will run everytime when we enter the user edit page (View/Members/Edit.cshtiml) and then add a record into the [BadgeTypeTimeLastChecked] table for Profile badge type of current user if there is no such record.

When the user hit the save button to upload his avatar picture, the ProfileBadgeCheck() will run again and found the record which just be added when he entered this page several minutes ago. If the record is not added "over 10 minutes ago", then it is marked "Recently Processed" and so the "Photogenic" badge will not be checked and added at that moment.

To solve this problem, I just added an if statement to check whether it's a "post" request or not in user edit page (View/Members/Edit.cshtiml) to stop running ProfileBadgeCheck() before the user hit the save button.
I am not sure if it's the best solution but it works.

@if (Request.HttpMethod == "POST") {
 @section Header {
  <script type="text/javascript">
   $.ajax({
    url: app_base + 'Badge/ProfileBadgeCheck',
    type: 'POST',
    error: function (xhr, ajaxOptions, thrownError) {
     ShowUserMessage("Error: " + xhr.status + " " + thrownError);
    }
   });
  </script>
 }
}

  • Liked by
  • YodasMyDad
YodasMyDad posted this 12 September 2017

Please add as issue on Github, or do a pull request. Thanks.

Close