X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fmentor.inc.php;h=64b1de74e81707602a02c47b5f3276125c08204d;hb=6dae45b393a59fd04713b9c651ff0970aeec84d7;hp=d1509a83f362504e6b426d2cc4e2a76de5213ceb;hpb=a7c29df3b9bf8f3c3b23fec0f1d2feb814cb61fe;p=platal.git diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php index d1509a8..64b1de7 100644 --- a/modules/profile/mentor.inc.php +++ b/modules/profile/mentor.inc.php @@ -136,9 +136,18 @@ class ProfileMentor extends ProfilePage protected function _saveData() { if ($this->changed['expertise']) { - XDB::execute("REPLACE INTO mentor (uid, expertise) - VALUES ({?}, {?})", - S::i('uid'), $this->values['expertise']); + $expertise = trim($this->values['expertise']); + if (empty($expertise)) { + XDB::execute("DELETE FROM mentor + WHERE uid = {?}", + S::i('uid')); + $this->values['expertise'] = null; + } else { + XDB::execute("REPLACE INTO mentor (uid, expertise) + VALUES ({?}, {?})", + S::i('uid'), $expertise); + $this->values['expertise'] = $expertise; + } } }