Suyou Network (10 years of experience), serves tens of thousands of companies, and has fixed transparent quotations.Domain name registration, hosting /One-stop service for server and website source code.A physical company, a professional team, worth choosing!Website building business: corporate website construction, company official website production, foreign trade website construction, website imitation, website copying, imitation site, foreign trade website construction, single-page customer service WeChat【 suyoufuwu】
How to call a member's custom attribute on the content details page?Below is a modification method for you. Upgrading this method will not affect your use.
1.Open this file /extend/function.php, 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 = \think\Db::name('users')->where('admin_id',$admin_id)->value('users_id');
}
$users_list = \think\Db::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.In the last step, fill in the tag call in the template
{$eyou.field.users_id|diy_users_attr_value=###,3,$eyou.field.admin_id}
The 3 in the tag defines the value of the attribute field for the member, 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.
legend:
Template tags

Front-end effect:


The above is the "Method of calling member custom attributes on Yiyou Content Page" shared by SUYU.com and everyone. Thank you very much for reading this article patiently. We will provide you with more information on reference, use or learning and communication.We can also provide you with:Enterprise website construction, website imitation, website copying, imitation site, foreign trade website construction, foreign trade website construction, company official website productionFor services, our company serves customers with the service concept of "integrity, professionalism, pragmatism and innovation".If you need cooperation, please scan the code to consult, and we will serve you sincerely.
TAG Label: