discuz在帖子列表页调取主题数、回帖数、收藏数、新短消息
//获取用户信息//主题数
$_G['tan']['threads']=getuserprofile('threads');
//回帖数
$_G['tan']['posts']=getuserprofile('posts')-$_G['tan']['threads'];
//收藏数
$_G['tan']['favtimes']=getuserprofile('favtimes');
//新短消息
loaducenter();//这个必须加上否则会报错,这个是用来调用Ucenter相关函数信息
$arr = uc_pm_checknew($_G['uid'],1);
这个为上面的解释,getuserprofile 获取用户信息任意字段函数,在举几个例子供大家参考,此函数,提供一个参数,内容为用户的字段名,即可返回出来他值的内容.
如:我要获取用户
威望::getuserprofile('extcredits1')
金钱: getuserprofile('extcredits2')
贡献:getuserprofile('extcredits3')
用户uid:getuserprofile(uid')
听从:getuserprofile('follower ')
收听:getuserprofile('following ')
主题:getuserprofile('threads')
直接在你需要的页面直接写就可以.
loaducenter()在文件 source/function/function_core.php 中:
function loaducenter() {
require_once DISCUZ_ROOT.'./config/config_ucenter.php';
require_once DISCUZ_ROOT.'./uc_client/client.php';
}
页:
[1]