public static function profile_criteria_review(\core\event\user_updated $event) {
        global $DB, $CFG;

        if (!empty($CFG->enablebadges)) {
            require_once($CFG->dirroot.'/lib/badgeslib.php');
            $userid = $event->objectid;

            if ($rs = $DB->get_records('badge_criteria', array('criteriatype' => BADGE_CRITERIA_TYPE_PROFILE))) {
                foreach ($rs as $r) {
                    $badge = new badge($r->badgeid);
                    if (!$badge->is_active() || $badge->is_issued($userid)) {
                        continue;
                    }

                    if ($badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->review($userid)) {
                        $badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->mark_complete($userid);

                        if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
                            $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
                            $badge->issue($userid);
                        }
                    }
                }
            }
        }
    }
public static function profile_criteria_review(\core\event\user_updated $event) {
        global $DB, $CFG;

        if (!empty($CFG->enablebadges)) {
            require_once($CFG->dirroot.'/lib/badgeslib.php');
            $userid = $event->objectid;

            if ($rs = $DB->get_records('badge_criteria', array('criteriatype' => BADGE_CRITERIA_TYPE_PROFILE))) {
                foreach ($rs as $r) {
                    $badge = new badge($r->badgeid);
                    if (!$badge->is_active() || $badge->is_issued($userid)) {
                        continue;
                    }

                    if ($badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->review($userid)) {
                        $badge->criteria[BADGE_CRITERIA_TYPE_PROFILE]->mark_complete($userid);

                        if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
                            $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
                            $badge->issue($userid);
                        }
                    }
                }
            }
        }
    }
public static function profile_criteria_review ( \ core \ event \ user_updated $ event ) { global $ DB , $ CFG ; if ( ! empty ( $ CFG -> enablebadges ) ) { require_once ( $ CFG -> dirroot . '/lib/badgeslib.php' ) ; $ userid = $ event -> objectid ; if ( $ rs = $ DB -> get_records ( 'badge_criteria' , array ( 'criteriatype' => BADGE_CRITERIA_TYPE_PROFILE ) ) ) { foreach ( $ rs as $ r ) { $ badge = new badge ( $ r -> badgeid ) ; if ( ! $ badge -> is_active ( ) || $ badge -> is_issued ( $ userid ) ) { continue ; } if ( $ badge -> criteria [ BADGE_CRITERIA_TYPE_PROFILE ] -> review ( $ userid ) ) { $ badge -> criteria [ BADGE_CRITERIA_TYPE_PROFILE ] -> mark_complete ( $ userid ) ; if ( $ badge -> criteria [ BADGE_CRITERIA_TYPE_OVERALL ] -> review ( $ userid ) ) { $ badge -> criteria [ BADGE_CRITERIA_TYPE_OVERALL ] -> mark_complete ( $ userid ) ; $ badge -> issue ( $ userid ) ; } } } } } }
Triggered when 'user_updated' event happens.

@param \core\event\user_updated $event event generated when user profile is updated.
Triggered when user_updated event happens .