在Joomla 3.7的jos_user表上添加更多列1.3
问题描述:
我正在开发自定义身份验证插件,用于从第三方API登录joomla。在Joomla 3.7的jos_user表上添加更多列1.3
当我们使用用户名/密码登录任何Joomla实例时,用户/密码传递给API获取正确的响应(如login_id,username,employee_ident,email,通用名称)。然后Joomla在Joomla上创建用户,保存在Joomla数据库上的回复,如(用户名,全名,电子邮件)。现在ccms auth插件工作正常。
我的要求是在API中使用用户身份验证插件时,在jos_users上另存一列。为此,我在jos_user表中创建了一列employee_ident,但无法将joomla db中的employee_ident保存在jos_user表中。
这里是我的代码:
$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 = '';
}
答
您应该创建一个档案插件这一点。默认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
你似乎有print_r的的''在你的代码中()的输出。那将无法运行,你会将它编辑为你实际拥有的吗? – halfer