protected function get_user_fullname($userid) {
        global $DB;

        if (empty($userid)) {
            return false;
        }

        if (!empty($this->userfullnames[$userid])) {
            return $this->userfullnames[$userid];
        }

        // We already looked for the user and it does not exist.
        if ($this->userfullnames[$userid] === false) {
            return false;
        }

        // If we reach that point new users logs have been generated since the last users db query.
        list($usql, $uparams) = $DB->get_in_or_equal($userid);
        $sql = "SELECT id," . get_all_user_name_fields(true) . " FROM {user} WHERE id " . $usql;
        if (!$user = $DB->get_records_sql($sql, $uparams)) {
            return false;
        }

        $this->userfullnames[$userid] = fullname($user);
        return $this->userfullnames[$userid];
    }
protected function get_user_fullname($userid) {
        global $DB;

        if (empty($userid)) {
            return false;
        }

        if (!empty($this->userfullnames[$userid])) {
            return $this->userfullnames[$userid];
        }

        // We already looked for the user and it does not exist.
        if ($this->userfullnames[$userid] === false) {
            return false;
        }

        // If we reach that point new users logs have been generated since the last users db query.
        list($usql, $uparams) = $DB->get_in_or_equal($userid);
        $sql = "SELECT id," . get_all_user_name_fields(true) . " FROM {user} WHERE id " . $usql;
        if (!$user = $DB->get_records_sql($sql, $uparams)) {
            return false;
        }

        $this->userfullnames[$userid] = fullname($user);
        return $this->userfullnames[$userid];
    }
protected function get_user_fullname ( $ userid ) { global $ DB ; if ( empty ( $ userid ) ) { return false ; } if ( ! empty ( $ this -> userfullnames [ $ userid ] ) ) { return $ this -> userfullnames [ $ userid ] ; } // We already looked for the user and it does not exist. if ( $ this -> userfullnames [ $ userid ] === false ) { return false ; } // If we reach that point new users logs have been generated since the last users db query. list ( $ usql , $ uparams ) = $ DB -> get_in_or_equal ( $ userid ) ; $ sql = "SELECT id," . get_all_user_name_fields ( true ) . " FROM {user} WHERE id " . $ usql ; if ( ! $ user = $ DB -> get_records_sql ( $ sql , $ uparams ) ) { return false ; } $ this -> userfullnames [ $ userid ] = fullname ( $ user ) ; return $ this -> userfullnames [ $ userid ] ; }
Gets the user full name.

This function is useful because, in the unlikely case that the user is
not already loaded in $this->userfullnames it will fetch it from db.

@since Moodle 2.9
@param int $userid
@return string|false
Gets the user full name .