2012-08-24 34 views
1

我想出如何让杜本seperatlyConcrete5用户属性

显示用户属性:

<?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

你试过'$ uia->的getAttribute( '名' );'?我不知道Concrete5,但根据你的两个代码示例,这应该做到这一点。 – hakre

回答

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; 
?>