I am developing custom authentication plugin for login in joomla from third party API.
When we login on any Joomla instance with user/password then the user/pass is passed to API get the correct response (like login_id, username, employee_ident, email, common name.) Then Joomla create the user on Joomla and save the response like (username,fullname ,email) on Joomla database. Now ccms auth plugin is working fine.
My requirement is to save one more column on jos_users while user authentication plugin from API. For this I have created the one column employee_ident in jos_user table but am not able to save employee_ident in joomla db on jos_user table.
Here is my code:
$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 = '';
}
You should create a Profile Plugin for this. By default Joomla! has a
#__user_profiles
table that can hold additional user information.See this page from JDocs for more information: https://docs.joomla.org/Creating_a_profile_plugin/en
Another example is the core profile plugin: https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php