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.

VazVaz New
edited December 2008 in Vanilla 1.0 Help
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

Comments

  • edited May 2007
    Create a new Nugget
    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.
  • Thanks
  • Ive played around with the $sql->AddLimit(0, 1); (im not a programmer) but what im trying to get is for it to list the last 4 new members.. Any advice ?
  • judgejjudgej
    edited December 2008
    Change the '1' to '4' in this line:

    $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.
  • Thanks so much, that was perfecto!
This discussion has been closed.