Page 5 of 5 FirstFirst ... 345
Results 41 to 45 of 45
  1. #41
    Registered User/Coder Rupert Avery's Avatar
    Join Date
    Nov 2011
    Location
    Scotland
    Posts
    157

    Default

    We did have that but then it had to be modified so that it would link to the users profile although I will try someting that you suggested that I didnt try thank you
    www.ultima-auctions.com powered by webid

  2. #42
    Registered User/Coder Rupert Avery's Avatar
    Join Date
    Nov 2011
    Location
    Scotland
    Posts
    157

    Default

    Quote Originally Posted by pani100 View Post
    just a quick note, looking at the code here if you want to pull more than 1 variable try something like this: (i have not tested it to see if this runs)

    // get the last 3 users
    $query = "SELECT id, lastlogin, nick FROM " . $DBPrefix . "users ORDER by lastlogin DESC LIMIT 3" ;
    $res = mysql_query($query);
    $system->check_mysql($res, $query, __LINE__, __FILE__);
    while($row = mysql_fetch_assoc($res)) {

    $template->assign_block_vars('lastusers', array(

    'ID' => $row['id'],
    'LASTLOGIN' => $row['lastlogin'],
    'USER' => $row['nick']
    ));
    }

    in the tpl use <!-- BEGIN lastusers -->
    ...... your code......
    <!-- END lastusers -->

    this didn't work

    My 3 goals for my site seem so far away right now hehe
    www.ultima-auctions.com powered by webid

  3. #43
    Registered User/Coder Xeonn's Avatar
    Join Date
    Dec 2011
    Location
    Poland, Gdansk
    Posts
    376

    Default

    Quote Originally Posted by Rupert Avery View Post
    this didn't work

    My 3 goals for my site seem so far away right now hehe
    By the way, didn't it works earlier when I post first version which you adapted to your site? Maybe you should use this?
    If you found my posts helpful, feel free to thumb it up
    FORCE ME TO WORK HARDER ----> DONATE recived (147 $) THANKS ALL

  4. #44
    Registered User/Coder Rupert Avery's Avatar
    Join Date
    Nov 2011
    Location
    Scotland
    Posts
    157

    Default

    Quote Originally Posted by Xeonn View Post
    By the way, didn't it works earlier when I post first version which you adapted to your site? Maybe you should use this?
    Yes it did trouble was it didn't link to profiles.. might revert back hehe I am just lazy
    www.ultima-auctions.com powered by webid

  5. #45
    Registered User/Coder Rupert Avery's Avatar
    Join Date
    Nov 2011
    Location
    Scotland
    Posts
    157

    Default

    Okay with a mixture of both of your help! I got 3 users showing and them linking properly!

    For Last users
    in Index.php
    Code:
    //last user
    $query = "SELECT id, nick, reg_date FROM " . $DBPrefix . "users ORDER BY reg_date DESC LIMIT 3";
    $res = mysql_query($query);
    $system->check_mysql($res, $query, __LINE__, __FILE__);
    while ($lastuser = mysql_fetch_assoc($res))
    {
    $template->assign_block_vars('lastuser', array(
    'ID' => $lastuser['id'],
    'NICK' => $lastuser['nick'],
    'DATA_REG' => FormatDate($lastuser['reg_date'])
    ));
    }

    For Home.tpl
    Code:
    <!-- BEGIN lastuser -->
    <ul>
    <li><a href="{SITEURL}profile.php?user_id={lastuser.ID}">{lastuser.NICK}<br>{lastuser.DATA_REG}</li>
    </ul>
    <!-- END lastuser -->

    Thank you everyone for your help seriously!! Mega thank you!.. Just away to adapt it to be for last user login!!


    Last Log in Code!

    For index.php
    Code:
    //last login
    $query = "SELECT id, nick, lastlogin FROM " . $DBPrefix . "users ORDER BY lastlogin DESC LIMIT 3";
    $res = mysql_query($query);
    $system->check_mysql($res, $query, __LINE__, __FILE__);
    while ($lastlogin = mysql_fetch_assoc($res))
    {
    $template->assign_block_vars('lastlogin', array(
    'ID' => $lastlogin['id'],
    'NICK' => $lastlogin['nick'],
    'LASTLOGIN' => $lastlogin['lastlogin']
    ));
    }
    Note LASTLOGIN does not need FormatDate because it is already in date format on DB

    for home.tpl
    Code:
    <!-- BEGIN lastlogin -->
    <ul>
    <li><a href="{SITEURL}profile.php?user_id={lastlogin.ID}">{lastlogin.NICK}<br>{lastlogin.LASTLOGIN}</li>
    </ul>
    <!-- END lastlogin -->
    these codes will give you a list of 3 users for most recently active and most recently registered. it can be changed to include as many as you want (i assume) and it will link to that users profile so you can easily fdind their active auctions and their feedback

    Again thank you everyone who helped I have learned a hell of a lot doing this! and think I could manipulate code with a little more confidence!
    Last edited by Rupert Avery; 23-03-2012 at 09:47 PM.
    www.ultima-auctions.com powered by webid

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •