1

私はこれを別々に行う方法を考え出しました

ユーザー属性を表示します。

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

しかし、それらを組み合わせる方法がわからないため、attribute('name');が表示されます。ページ所有者の

助けてくれませんか

ありがとう

4

1 に答える 1

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;  
?>
于 2012-08-24T16:31:26.157 に答える