- require_once 'notifs.inc.php';
- register_watch_op($this->user->id(), WATCH_FICHE, '', 'medals');
- return XDB::execute('REPLACE INTO profile_medals
- VALUES ({?}, {?}, {?})',
- $this->user->profile()->id(), $this->mid,
- is_null($this->gid) ? 0 : $this->gid);
+ return XDB::execute('INSERT INTO profile_medals (pid, mid, gid, level)
+ VALUES ({?}, {?}, {?}, {?})
+ ON DUPLICATE KEY UPDATE gid = VALUES(gid)',
+ $this->profile->id(), $this->mid,
+ is_null($this->gid) ? 0 : $this->gid, $this->level);