function get_userinfo($username) {
        global $CFG;

        $extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);

        $authdb = $this->db_init();

        // Array to map local fieldnames we want, to external fieldnames.
        $selectfields = $this->db_attributes();

        $result = array();
        // If at least one field is mapped from external db, get that mapped data.
        if ($selectfields) {
            $select = array();
            $fieldcount = 0;
            foreach ($selectfields as $localname=>$externalname) {
                // Without aliasing, multiple occurrences of the same external
                // name can coalesce in only occurrence in the result.
                $select[] = "$externalname AS F".$fieldcount;
                $fieldcount++;
            }
            $select = implode(', ', $select);
            $sql = "SELECT $select
                      FROM {$this->config->table}
                     WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'";

            if ($rs = $authdb->Execute($sql)) {
                if (!$rs->EOF) {
                    $fields = $rs->FetchRow();
                    // Convert the associative array to an array of its values so we don't have to worry about the case of its keys.
                    $fields = array_values($fields);
                    foreach (array_keys($selectfields) as $index => $localname) {
                        $value = $fields[$index];
                        $result[$localname] = core_text::convert($value, $this->config->extencoding, 'utf-8');
                     }
                 }
                 $rs->Close();
            }
        }
        $authdb->Close();
        return $result;
    }
function get_userinfo($username) {
        global $CFG;

        $extusername = core_text::convert($username, 'utf-8', $this->config->extencoding);

        $authdb = $this->db_init();

        // Array to map local fieldnames we want, to external fieldnames.
        $selectfields = $this->db_attributes();

        $result = array();
        // If at least one field is mapped from external db, get that mapped data.
        if ($selectfields) {
            $select = array();
            $fieldcount = 0;
            foreach ($selectfields as $localname=>$externalname) {
                // Without aliasing, multiple occurrences of the same external
                // name can coalesce in only occurrence in the result.
                $select[] = "$externalname AS F".$fieldcount;
                $fieldcount++;
            }
            $select = implode(', ', $select);
            $sql = "SELECT $select
                      FROM {$this->config->table}
                     WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'";

            if ($rs = $authdb->Execute($sql)) {
                if (!$rs->EOF) {
                    $fields = $rs->FetchRow();
                    // Convert the associative array to an array of its values so we don't have to worry about the case of its keys.
                    $fields = array_values($fields);
                    foreach (array_keys($selectfields) as $index => $localname) {
                        $value = $fields[$index];
                        $result[$localname] = core_text::convert($value, $this->config->extencoding, 'utf-8');
                     }
                 }
                 $rs->Close();
            }
        }
        $authdb->Close();
        return $result;
    }
function get_userinfo ( $ username ) { global $ CFG ; $ extusername = core_text :: convert ( $ username , 'utf-8' , $ this -> config -> extencoding ) ; $ authdb = $ this -> db_init ( ) ; // Array to map local fieldnames we want, to external fieldnames. $ selectfields = $ this -> db_attributes ( ) ; $ result = array ( ) ; // If at least one field is mapped from external db, get that mapped data. if ( $ selectfields ) { $ select = array ( ) ; $ fieldcount = 0 ; foreach ( $ selectfields as $ localname => $ externalname ) { // Without aliasing, multiple occurrences of the same external // name can coalesce in only occurrence in the result. $ select [ ] = "$externalname AS F" . $ fieldcount ; $ fieldcount ++ ; } $ select = implode ( ', ' , $ select ) ; $ sql = "SELECT $select
                      FROM {$this->config->table}
                     WHERE {$this->config->fielduser} = '" . $ this -> ext_addslashes ( $ extusername ) . "'" ; if ( $ rs = $ authdb -> Execute ( $ sql ) ) { if ( ! $ rs -> EOF ) { $ fields = $ rs -> FetchRow ( ) ; // Convert the associative array to an array of its values so we don't have to worry about the case of its keys. $ fields = array_values ( $ fields ) ; foreach ( array_keys ( $ selectfields ) as $ index => $ localname ) { $ value = $ fields [ $ index ] ; $ result [ $ localname ] = core_text :: convert ( $ value , $ this -> config -> extencoding , 'utf-8' ) ; } } $ rs -> Close ( ) ; } } $ authdb -> Close ( ) ; return $ result ; }
Reads any other information for a user from external database,
then returns it in an array.

@param string $username
@return array
Reads any other information for a user from external database then returns it in an array .