Community Documentation

List users who have recently updated their blog

Last updated September 13, 2006. Created by greggles on September 13, 2006.
Log in to edit this page.

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!

About this page

Drupal version
Drupal 4.7.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.