users recent logins, recent activity

Events happening in the community are now at Drupal community events on www.drupal.org.
toma's picture

Hello

I am working on website and like to use a block with last users login, or active members in my website

some website using thins function

http://drupalsn.com/

Active people today

http://teamsugar.com/

Some of our recently active members...
http://www.whatnow.org.uk/

Recently active members
http://www.whatnow.org.uk/people

I am trying with usernode module and views "set criteria to last login access, ) but without success

anyone have a solution?

Thanks

Comments

who's online

alex.k's picture

It sounds like the "who's online" block. Does that one work for you? If by "active" you mean users who did something on the site (posted, commented, registered, and so on) - a view or a block powered by Activity module would be a solution.

All i want is a block/view

toma's picture

All i want is a block/view with last active members as you say one who login etc with user picture like it show in some example website's i give in my first post

Avatar blocks

michelle's picture

It's for D5 but may give you some ideas... http://drupal.org/project/avatar_blocks

Michelle


See my Drupal articles and tutorials or come check out the Coulee Region

I am using avatar blocks

toma's picture

I am using avatar blocks module aswell for my website! its only for drupal 5 and imagecache 2

Put this inside a block and

preetinder's picture

Put this inside a block and set format to PHP Code

<?php
$active_week_result
= db_query_range("
SELECT uid, SUM(count) sum FROM (
(
SELECT u.uid, COUNT(DISTINCT(n.nid)) count
FROM {users} u
LEFT JOIN {node} n ON u.uid = n.uid
WHERE u.uid <> 0
  AND n.created > %d - (15 * 24 * 60 * 60)
GROUP BY u.uid
) UNION (
SELECT u.uid, COUNT(DISTINCT(c.cid)) count
FROM {users} u
LEFT JOIN {comments} c ON c.uid = u.uid
WHERE u.uid <> 0
  AND c.timestamp > %d - (15 * 24 * 60 * 60)
GROUP BY u.uid
)
ORDER BY count DESC
) as x
GROUP BY uid
ORDER BY count DESC"
, time(), time(),
0, 12); //Change the second number in this line to the number of results you want to get.

?>

<table border=0 cellpadding="2" cellspacing="2" >
<?
       
   $cnt=0;
    while($row = db_fetch_array($active_week_result)){
     $user_info = user_load(array('uid' => $row['uid']));           
        if($user_info->picture)
        $defpic = base_path().$user_info->picture;
       else
          $defpic = base_path()."files/pictures/noimage.gif";

      $cnt++;
        if ($cnt==1)
       {
          print "<tr><td  ><div align=\"center\"><a href=\"/$user_info->name\" title=\"View $user_info->name 's profile and brief bio.\">";      print '<img border="1" border-color="#eaeaea" src="'.$defpic.'" width=50 height=50><br>';
          print substr($user_info->name,0,8);
         //profile_load_profile($user_info);
            print "</a></div></td>";
       }
      else if ($cnt==2)
      {
          echo "<td >";
          print "<div align=\"center\"><a href=\"/$user_info->name\" title=\"View $user_info->name 's profile and brief bio.\">";      print '<img border="1" border-color="#eaeaea" src="'.$defpic.'" width=50 height=50><br>';
            print substr($user_info->name,0,8);
         //profile_load_profile($user_info);
            print "</a></div></td>";

      }
      else
       {
          echo "<td >";
          print "<div align=\"center\"><a href=\"/$user_info->name\" title=\"View $user_info->name 's profile and brief bio.\">";      print '<img border="1" border-color="#eaeaea" src="'.$defpic.'" width=50 height=50><br>';
            print substr($user_info->name,0,8);
         //profile_load_profile($user_info);
            print "</a></div></td></tr>";
            $cnt=0;
        }
  }
?>
</table>

You may need to change the HTML part as per your website's theme/requirements.

let me know if this helps.

Thanks a lot for your code,

toma's picture

Thanks a lot for your code, its what i need, it work fine for me

Please don't tell people to

sirkitree's picture

Please don't tell people to put PHP code in blocks - it's a very bad practice and could crash a site. If you need a custom block learn how to do it in code please please please. I don't know how many site's I've had to try to fix because someone put bad code inside a php block which gets saved to the database and makes it VERY hard to troubleshoot. One should NEVER encourage this practice. I wish the ability was taken out completely.

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week