/**
  * Overriding version of the set() function to deal with the selecting userid from username
  *
  * @param	string	Name of the field
  * @param	mixed	Value of the field
  *
  * @return	boolean	Returns true on success
  */
 function set($fieldname, $value)
 {
     switch ($fieldname) {
         case 'username':
         case 'modusername':
             if ($value != '' and $userinfo = $this->dbobject->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE username = '******'")) {
                 $this->do_set('userid', $userinfo['userid']);
                 $this->info['user'] =& $userinfo;
                 return true;
             } else {
                 $this->error('no_users_matched_your_query_x', $value);
                 return false;
             }
             break;
         default:
             return parent::set($fieldname, $value);
     }
 }
Пример #2
0
 /**
  * Overriding version of the set() function to deal with the selecting userid from username
  *
  * @param	string	Name of the field
  * @param	mixed	Value of the field
  *
  * @return	boolean	Returns true on success
  */
 function set($fieldname, $value, $clean = true, $doverify = true, $table = null)
 {
     switch ($fieldname) {
         case 'username':
         case 'modusername':
             if ($value != '' and $userinfo = $this->assertor->getRow('user', array('username' => $value))) {
                 $this->do_set('userid', $userinfo['userid']);
                 $this->info['user'] =& $userinfo;
                 return true;
             } else {
                 $this->error('no_users_matched_your_query_x', $value);
                 return false;
             }
             break;
         default:
             return parent::set($fieldname, $value);
     }
 }