2017-09-01 14 views
0

私はサードパーティのAPIからjoomlaにログインするためのカスタム認証プラグインを開発しています。Joomla 3.7のjos_userテーブルにもう1つのカラムを追加

ユーザー/パスワードでJoomlaのインスタンスにログインすると、ユーザー/パスがAPIに渡されます(login_id、username、employee_ident、email、common nameなどの正しい応答が得られます)。次にJoomlaはJoomlaでユーザーを作成し、 Joomlaデータベースに(username、fullname、email)のようなレスポンスを保存します。今、ccms auth pluginが正常に動作しています。

私の要件は、jos_usersに1つ以上の列を保存し、APIからのユーザー認証プラグインです。このため、私はjos_userテーブルにemployee_identという列を1つ作成しましたが、jos_userテーブルのjoomla dbにemployee_identを保存することはできません。

$result = $client->call($method, $params); 

[0] => Array 
    (
     [login_id] => Frasier.9878 
     [email_address] => [email protected] 
     [position_code_type_ident] => 157 
     [employee_ident] => 166651 
     [position_code_department_abbr_name] => executive_management 
     [position_code_title] => Chief Financial Officer 
     [hire_date] => 2003-01-20 
     [common_name] => Frasier Crane 

    ) 
if($result) 
      {  
      $email_address   = isset($result[0][email_address]) ? $result[0][email_address] : $credentials['username']."@test.com"; 
      $response->email   = $email_address; 
      $response->fullname  =$result[0][common_name]; 
      $response->employee_ident =$result[0][employee_ident];    
      $response->username  =$credentials['username']; 

      $response->status  = JAuthentication::STATUS_SUCCESS; 
      $response->error_message = ''; 

     } 
+0

あなたはあなたのコードの途中で ')(しますprint_r'の出力を持っているようです。それは、あなたが実際に持っているものに編集するでしょうか? – halfer

答えて

0

あなたはこのためにプロフィールプラグインを作成する必要があります。

は、ここに私のコードです。デフォルトではJoomla!追加のユーザー情報を保持できる#__user_profilesテーブルがあります。

詳細についてはJDocsから、このページを参照してください:https://docs.joomla.org/Creating_a_profile_plugin/en

別の例は、コアプロファイルのプラグインです: https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php

関連する問題