Post-awarding course badges for already unenrolled users

Post-awarding course badges for already unenrolled users

by Michael E -
Number of replies: 3
Picture of Core developers Picture of Testers

Hello Everyone,

Is there a suggested process for awarding course badges for users which are already unenrolled? I have a list of these people. We started introducing badges after the course was initial created, now we want to award them to these already unenrolled students too.

My idea is to manually insert the record into MDL_BADGE_ISSUED. But what's the process of creating the uniquehash? Can I just put any unique string?

 

Thanks!

Average of ratings: -
In reply to Michael E

Re: Post-awarding course badges for already unenrolled users

by Randy Thornton -
Picture of Documentation writers

The uniquehash is an SHA-1 hashed string built from a random number, the user and badge ids, and the current time when the badge is issued to the user.

It's the unique identifier for each issued badge and is used in the URL to link back to that specific instance of the badge.  If you look in your Open Badges Backpack at Criteria and Evidence fields, you will see the URL with the hash number linking back to page for that badge.

In theory, I suppose any number would work as long as it was unique in your site for that badge issuance.

The most proper way would be to make the number the same way as the code (in /lib/badgeslib.php)

uniquehash = sha1(rand() . $userid . $this->id . $now)

where $this->id is the badge id and $now is time().

You can use a site like http://www.sha1-lookup.com/ to generate the number if you have the time() and copy/paste in the id numbers to do this manually.

I have not tried this at home ;)

Randy

 

 

 

 

In reply to Randy Thornton

Re: Post-awarding course badges for already unenrolled users

by Michael E -
Picture of Core developers Picture of Testers

Randy,

Thank you so much! This will be very helpful to me.

In reply to Michael E

Re: Post-awarding course badges for already unenrolled users

by Randy Thornton -
Picture of Documentation writers

 

Michael,

Most welcome. And I did "try this at home" and it worked! Very cool.