I want to create a simple module that uses hook_user to display the 5 most recent user submitted images on a user profile page (http://drupal.org/user/1).
I don't want to go down the route of overriding the user profile page using the template.php technique - http://drupal.org/node/35728. I am actually able to pull the 5 most recent images using the template.php override technique, but I don't want to rewrite everything that interacts with the user.module. Therefore, I have recently found the module hook system drupal uses and this seems to be a much better way to do what I need.
I am not fully understanding the hook_user syntax from the api here - http://api.drupal.org/api/4.7/function/hook_user. Here is the code I have so far:
/**
* Implementation of hook_user().
*/
function userprofileimages_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'view'){
// Display N most recent thumbnails of images submitted by the user
// Each thumbnail is linked back to it's image node
// The number of thumbnail images to show
$nlimit = 5;
$userid = $user->uid;
$sql = "SELECT n.created, n.title, n.nid, n.changed FROM {node} n WHERE n.type = 'image' AND n.uid = $userid AND n.status = 1 AND n.promote = 1 ORDER BY n.changed DESC";
$result = db_query_range($sql, 0, $nlimit);
$output_content = '';
while ( $info = db_fetch_object($result) ) {