我想出了如何分开这个
显示用户属性:
<?php
//Create a User object (of the current User)
$u = new User();
//Creat a UserInfo object with the user ID
$ui = UserInfo::getByID($u->getUserID());
//Get the Value of your user Attribute
$value = $ui->getAttribute('name');
//Print it out
echo $value;
?>
显示页面所有者:
<?php
$ownerID = $cobj->getCollectionUserID();
$uia = UserInfo::getByID($ownerID);
$ownerName = $uia->getUserName();
echo $ownerName
?>
但是我无法弄清楚如何将它们组合在一起以显示属性('name');页面所有者
你能帮忙吗
由于
答案 0 :(得分:1)
用代码移动了一点之后。 我发现我只需要移动
$cobj->getCollectionUserID();
到
$ui = UserInfo::getByID($u->getUserID());
所以完成的代码:
<?php
//Creat a UserInfo object with the Owner
$ui = UserInfo::getByID($cobj->getCollectionUserID() );
//Get the Value of your user Attribute
$value = $ui->getAttribute('name');
//Print it out
echo $value;
?>