·设为首页收藏本站📧邮箱修改🎁免费下载专区🔐设置/修改密码👽群雄群聊
返回列表 发布新帖

discuz 获取用户资料getuserprofile函数解析

252 1
发表于 2021-12-29 17:16:37 | 显示全部楼层 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
此函数,提供一个参数,内容为用户的字段名,即可返回出来他值的内容
如:我要获取用户
威望::getuserprofile('extcredits1')
金钱: getuserprofile('extcredits2')
贡献:getuserprofile('extcredits3')
用户uid:getuserprofile(uid')
听从:getuserprofile('follower ')  
收听:getuserprofile('following ')  
主题: getuserprofile('threads')

函数定义:function_core.php
函数参数:
field:资料段名称
返回值:存在返回资料内容反正返回null
  1. function getuserprofile($field) {        global $_G;        if(isset($_G['member'][$field])) {                return $_G['member'][$field];        }        static $tablefields = array(                'count'                => array('extcredits1','extcredits2','extcredits3','extcredits4','extcredits5','extcredits6','extcredits7','extcredits8','friends','posts','threads','digestposts','doings','blogs','albums','sharings','attachsize','views','oltime','todayattachs','todayattachsize', 'follower', 'following', 'newfollower', 'blacklist'),                'status'        => array('regip','lastip','lastvisit','lastactivity','lastpost','lastsendmail','invisible','buyercredit','sellercredit','favtimes','sharetimes','profileprogress'),                'field_forum'        => array('publishfeed','customshow','customstatus','medals','sightml','groupterms','authstr','groups','attentiongroup'),                'field_home'        => array('videophoto','spacename','spacedescription','domain','addsize','addfriend','menunum','theme','spacecss','blockposition','recentnote','spacenote','privacy','feedfriend','acceptemail','magicgift','stickblogs'),                'profile'        => array('realname','gender','birthyear','birthmonth','birthday','constellation','zodiac','telephone','mobile','idcardtype','idcard','address','zipcode','nationality','birthprovince','birthcity','resideprovince','residecity','residedist','residecommunity','residesuite','graduateschool','company','education','occupation','position','revenue','affectivestatus','lookingfor','bloodtype','height','weight','alipay','icq','qq','yahoo','msn','taobao','site','bio','interest','field1','field2','field3','field4','field5','field6','field7','field8'),                'verify'        => array('verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6', 'verify7'),        );        $profiletable = '';        foreach($tablefields as $table => $fields) {                if(in_array($field, $fields)) {                        $profiletable = $table;                        break;                }        }        if($profiletable) {                if(is_array($_G['member']) && $_G['member']['uid']) {                        space_merge($_G['member'], $profiletable);                } else {                        foreach($tablefields[$profiletable] as $k) {                                $_G['member'][$k] = '';                        }                }                return $_G['member'][$field];        }        return null;}
复制代码
我要说一句 收起回复

评论1

婷姐Lv.8 发表于 2021-12-29 17:17:29 | 显示全部楼层
这个是看起来很专业的,这个是不错的,
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图

您的IP:18.119.172.146,119.167.254.51,GMT+8, 2024-5-7 05:31 , Processed in 0.188009 second(s), 79 queries , Gzip On, Redis On.

Based on Discuz! W1.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表