When I want to call member custom attributes on the content details page, how do I call it? Here is a modification method for you. The upgrade of this method will not affect the use.
1. Open this file /extend/function.php and add the following code
if (!function_exists('diy_users_attr_value')) {
/**
* 获取会员属性值
*/
function diy_users_attr_value($users_id = '', $para_id = '', $admin_id = '')
{
$info = '';
static $users_list = null;
if (null === $users_list) {
if(empty($users_id) && !empty($admin_id)){
$users_id = hinkDb::name('users')->where('admin_id',$admin_id)->value('users_id');
}
$users_list = hinkDb::name('users_list')->where(['users_id'=>$users_id])->getAllWithIndex('para_id');
}
if (!empty($users_list[$para_id])) {
$info = $users_list[$para_id]['info'];
}
$info = preg_replace('#(.*)(#39;|"|"|')?(/[/w]+)?(/uploads/)(.*)#iU', '$1$2'.ROOT_DIR.'$4$5', $info);
return $info;
}
}
2. View member attribute values
3. The last step is to fill in the tag call in the template
{$eyou.field.users_id|diy_users_attr_value=###,3,$eyou.field.admin_id}
3 in the tag is the value of the member's custom attribute field, which is the value obtained by our second review element.
Follow the above steps to call the member's custom attribute field on the details page.