0

:) この質問は、Tankauth プラグインに詳しい人向けです。

ユーザープロファイルが電子メール検証なしで入力されるように、tankauth を編集しました。

登録フォームに、「first_name」と「last_name」という名前の 2 つのフィールドを追加して検証しました。フォームが送信されたときに、これらのフィールドを user_profiles テーブルに追加します。

以下は、ユーザーがアクティブ化されている場合にユーザー ID を user_profiles テーブルに追加する tankauth 関数です。if ($activated) をコメントアウトしました。問題は、新しいフィールド first_name と last_name をデータベースに挿入する方法がわからないことです。何をしようとしてもエラーが発生し続けます。

function create_user($data, $activated = TRUE)
    {
        $data['created'] = date('Y-m-d H:i:s');
        $data['activated'] = $activated ? 1 : 0;

        if ($this->db->insert($this->table_name, $data)) {
            $user_id = $this->db->insert_id();
            //if ($activated)
            $this->create_profile($user_id);
            return array(
                         'user_id' => $user_id,
                         'first_name' => $first_name, //added by me
                                                 'first_name' => $first_name, //added by me
                         );
        }
        return NULL;
    } 

上記は接続されています

private function create_profile($user_id) 
    {
        $this->db->set('user_id', $user_id);
        $this->db->set('first_name', $first_name); //added by me
        return $this->db->insert($this->profile_table_name);
    } 

誰かがいくつかのガイダンスを共有できますか?

4

1 に答える 1

1

privateインを削除してみてくださいprivate function create_profile

create_profileまた、関数を次のように変更することもできます。

function create_profile( $user_id ) {
    $data = array(
        'user_id' => $user_id,
        'first_name' => $first_name // Hopefully this is being set correctly.
    );

    return $this->db->insert( $this->profile_table_name, $data );
}

それらのどれも機能しない場合。使ってみてecho $this->db->last_query();

それが役立つことを願っています。

于 2011-05-24T02:08:48.877 に答える