List users who have recently updated their blog

Last modified: September 13, 2006 - 20:01

Displays a list of (x) users who have recently updated their blog with most recent udpates at top. Could also be used to find users who have recently edited any kind of node.

<?php
$sql
= "SELECT DISTINCT(n.uid), u.name FROM {node} n JOIN {users} u USING(uid) WHERE type = 'blog' ORDER BY n.changed DESC LIMIT 10";
$results = db_query($sql);
$items = array();
while (
$data = db_fetch_object($results) ) {
 
$items[] = l($data->name, "blog/$data->uid");
}

if (
count($items) ) {
  print
theme('item_list', $items);
}
?>

PLEASE NOTE! The above snippet is user submitted. Use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

NEVER just copy paste without looking at what it does, a user could potentially add a snippet that wipes your complete database!

 
 

Drupal is a registered trademark of Dries Buytaert.