Notification on Badges?

Notification on Badges?

by Seth Mengal -
Number of replies: 22

Hi, we are using Badges, but its kinda sad. When the student is awarded a badge there is no notifciation. Cant a Popup come or something?

Average of ratings: -
In reply to Seth Mengal

Re: Notification on Badges?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hello there. Well -they should get an email as notification but if you are looking for something more dramatic, there is a tracker issue here: MDL-39923

In reply to Mary Cooch

Re: Notification on Badges?

by Yoni Lerner -

I agree, the badges loses it's attractiveness if the user can't see that he earned it. 

Average of ratings: Useful (1)
In reply to Yoni Lerner

Re: Notification on Badges?

by Seth Mengal -

Yes i am aware of the Tracker issue now. Watching and Voting lol.

I agree with Yoni, i have placed the badges on the footer (block) so atleast my students can see them! smile It would be great if a popup was there.

Attachment Capture.PNG
In reply to Seth Mengal

Re: Notification on Badges?

by Ron Raney -

I would really appreciate if you could tell me how you did this. I have spent half a day trying to figure out how to display badges, for a number of reasons. I want the badges to be part the home page or something so that students can see them. Did you use a block for the footer? I am kind of a newbie to Moodle. 

In reply to Ron Raney

Re: Notification on Badges?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

There is My latest badges block which you can display on the front page or on the users's My home page (or if you are using Moodle 2.5.1 on a course page) It displays each user's own badges. I don't know of a way to display all available badges other than adding them to an html block. In Seth's picture above he has displayed this same block on the My home page. See My latest badges block and on the My home page you can display blocks in the centre.

In reply to Seth Mengal

Re: Notification on Badges?

by Yuliya Bozhko -

Hi guys,

I am really sorry. I was looking at adding some kind of popups to the notification, but haven't got time to finish this yet mixed. I will make sure to get back to this issue at some point. Would also appreciate any contributions that you would like to see in badges smile Being a sole maintainer of such a rather large feature is pretty difficult...

Yuliya

In reply to Yuliya Bozhko

Re: Notification on Badges?

by Doug Moody -

Yuliya,

I am very happy that someone is maintaining this feature. Thank you. But when you do get some time, please remember that many schools stdents don't have email, so using email as the only notification method is not good. As I think about it, would it be possible for admins or teachers to have a default message that can be created and sent out through ALL message channels in Moodle?

For example, if a student earns a badge, then every communicatoin method Moodle uses (messaging, Email, etc.) would pick us this default message and send it out. I was envisioning something like:

"Hello (variable to hold student name) You have achieved (variable to hold what achievements are possible, like grade percent or letter grade, or maybe even x numbe rof forum posts, or time spent in an activity) I am proud of you, and you are awarded the (variable to describe badge) badge"

Perhaps this message could be contained in a teacher configured field so that the teacher could insert a variable name within custom text?

But the most important thing is of course to just have notification capability beyond email.

Thanks again for helping the community.

Average of ratings: Useful (1)
In reply to Seth Mengal

Re: Notification on Badges?

by Doug Moody -

Seth,

I LIKE how you implemented putting the badges in the footer. I want to copy this technique.

Can you please explain how you did this?

In reply to Doug Moody

Re: Notification on Badges?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Doug - I expect Seth can tell us better but it looks to me like the My latest badges block has been added to the My home page and then moved into the centre (which you can do on the My home page) It would be good to know if it appears elsewhere on Seth's site too though.

Average of ratings: Useful (1)
In reply to Mary Cooch

Re: Notification on Badges?

by Seth Mengal -

Hi, You could use any theme which supports Footer, for me, i am using Essential https://moodle.org/plugins/browse.php?list=category&id=3 And then as Mary said, i am using the My Latest Badges Block on the homepage ( while the settings are for Where this Block Appears to be  at Any Page, 

 

Ill post a screenshot to help. Just make sure your using a theme with Footer, so it saves up all the programming smile

Attachment badge.JPG
Average of ratings: Useful (1)
In reply to Seth Mengal

Re: Notification on Badges?

by Seth Mengal -

And Yes Mary, the badges comes at every page smile Also the My profile Block

In reply to Seth Mengal

Re: Notification on Badges?

by Ron Raney -

This is all helping me out a lot. For now, having a block will suffice but some sort of live notification that a badge was earned would be great (in addition to the email). Just putting in my vote for something like this. Thanks for your work on this component!

 

 

Average of ratings: Useful (1)
In reply to Ron Raney

My latest badge block

by Seth Mengal -

 Hope you are doing great, so back to Badges, finally implementing it site wide.. A few questions?

As Mary saidBadges you make as a site admin will appear in the user's profile but not in the course as they are not course badges. Course badges will appear in the course badges link in a course but only in that course.

-

So, i intended to make Badges for each topic completion and when you complete a course, you get a Badge(Belt Image) for course completion. Is there a way or a workaround to make the previous badges earned throughout the course to not be visible at some area.

 

  1. The profile page shows all badges earned, regardless of the course.
  2. I was hoping first to make Course Completion badges on Site Home, so you can see only the course completion badges i.e the Belt on the 'My Latest Badges' block on the My Home Page or at the 'Profile'.
  3. And the badges block made inside the course, will only show Badges earned inside the course. i.e 'Course Badges'.

 

But it aint the case, as the My Latest Badges block shows all course badges even on the 'My Home Page', when it should only show 'Site Badges' at this point? Or am i missing something.

 

Thanks.



In reply to Seth Mengal

Re: My latest badge block

by Yuliya Bozhko -

Hi Seth,

Just to clarify some points. "My Latest Badges" block being added to My Home page will show to a user all badges earned by this user. When you add this block on the course page, it will show only badges from this particular course.

Yuliya

In reply to Yuliya Bozhko

Re: My latest badge block

by Seth Mengal -

Hi, yes I am aware of that.. I was looking though for a work around. As there would be well too many badges appearing on the site. We need to distinguish course completion badges different from the topic completion badges (collection of activities)..

 

I was hoping I will replicate the badge block, to another block which shows only the site wide badges. Would it be possible? I saw the lines where the course content was given, but then it wasn't working as expected.

 

Some instructions would be great thanks. So I will place the default badge block on the course page, and the little modified badge block for site badges on the my homepage..

 

Thanks.

In reply to Seth Mengal

Re: My latest badge block

by Yuliya Bozhko -

Hmmm, no, there is no option to display site badges only. In this case users will not be able to also showcase their course badges in site profile.

Your workaround would be to modify "badges_get_user_badges()" method from badgeslib.php to add a check for something like if $courseid is 1 (SITE) then get only site badges (it creates an SQL snippet which is used later to get the records).

Let me know if you need more information on that.

Yuliya

In reply to Yuliya Bozhko

Re: My latest badge block

by Seth Mengal -

Hi Yuliya

At line number 820, added

    if ($courseid = 1) {
    $sql = 'SELECT
                bi.uniquehash,
                bi.dateissued,
                bi.dateexpire,
                bi.id as issuedid,
                bi.visible,
                u.email,
                b.*
            FROM
                {badge} b,
                {badge_issued} bi,
                {user} u
            WHERE b.id = bi.badgeid
                AND u.id = bi.userid
                AND bi.userid = ?
                AND b.courseid = 1
            ORDER BY bi.dateissued DESC';
    }

 

But it resulted in

 

MY BADGES

You have not earned a badge yet
 
I suppose, i am not that great with queries afterall.
In reply to Seth Mengal

Re: My latest badge block

by Yuliya Bozhko -

Hi Seth,

Site badges have a different type value, and they don't store course ID. What you need to do is something like this: https://gist.github.com/ybozhko/9256984

Have a look if it does what you need. Just pass 1 (id of a site) as course id parameter in badges_get_user_badges().

Hope it helps.

Yuliya

Average of ratings: Useful (1)
In reply to Yuliya Bozhko

Re: My latest badge block

by Seth Mengal -
Sadly it didnt work as expected, i edited 827 onward as if ($courseid == SITEID) { $sql .= ' AND (b.type = ' . BADGE_TYPE_SITE . ') '; } else if ($courseid > 1) { $sql .= ' AND (b.courseid = ' . $courseid . ') '; } $sql .= ' ORDER BY bi.dateissued DESC'; $badges = $DB->get_records_sql($sql, $params, $page * $perpage, $perpage); return $badges; } - it returned with same results, My homepage and Sitepage shows all badges, that of the courses too. Not just sites.
In reply to Seth Mengal

Re: My latest badge block

by Yuliya Bozhko -

Hi Seth,

I don't think you understood the part where you need to pass 1 as courseid parameter when you call the method... I just tried myself and everything works for me. Right now in Badges block file there is a condition:

if ($courseid == SITEID) {
$courseid = null;
}

You either need to set $courseid = 1; or remove the entire if-statement because SITEID already equals 1 by default. With all these modifications Badges block will show only site badges when displayed on Home page and only course badges on Course page. You won't be able to display them together again unless you completely modify the block and add some settings where user can decide what they want to display.

Yuliya

Average of ratings: Useful (1)
In reply to Yuliya Bozhko

Re: My latest badge block

by Seth Mengal -

Ah, great! Works great, the 'My Home' & 'Site Home' are showing the 'Site Badges' & inside the course the 'Course Badges' are visible. \o/