Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Newest member username & profile link.
Vaz
New
Hi guys,
Just another question I'd like to ask. What's the php code for display a members username along with a link to his profile?
Also, just for future refference, is there any documentation or post regarding all the different variables which are present in vanilla.
Thanks
0
This discussion has been closed.
Comments
Name = Newest Member
Pan = Inside Panel
Weight = anything
HTML =
<?php global $Context; $sql = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder'); $sql->SetMainTable('User','u'); $sql->AddSelect(array('UserID', 'Name'), 'u'); $sql->AddOrderBy('UserID','u','desc'); $sql->AddLimit(0, 1); $result = $Context->Database->Select($sql, 'GetUserIDName', 'GetUserIDName', 'An error occurred while listing UserID and Name information of the newest user.'); $rows = $Context->Database->GetRow($result); echo '<li><a href="'.GetUrl($Context->Configuration, 'account.php', '', 'u', $rows['UserID']).'">'.$rows['Name'].'</a></li>'; ?>
save your done.
$sql->AddLimit(0, 1);
Then replace the display line with a loop:
while ($row = $Context->Database->GetRow($result)) { echo '<li><a href="'.GetUrl($Context->Configuration, 'account.php', '', 'u', $row['UserID']).'">'.$row['Name'].'</a></li>'; }
I haven't tried it, but it should work.