Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.468 diff -u -r1.468 user.module --- modules/user.module 5 May 2005 11:55:52 -0000 1.468 +++ modules/user.module 6 May 2005 15:59:02 -0000 @@ -585,6 +585,44 @@ } } +/** + * Generate a listing or feed of nodes belonging to a user. + * + * @param $uid + * The user's id. + * + * @param $op + * The operation. Can be null or 'feed'. Null returns a listing, 'feed' an RSS feed. + * + * @return + * $output + * The output for a node listing page with only one user's nodes listed. + */ +function user_nodes($uid, $op = null) { + + $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.status = 1 AND uid = %d ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10), 0, null, $uid); + + if ($op == 'feed') { + node_feed($result); + return; + } + + if (db_num_rows($result)) { + drupal_set_html_head(''); + + $output = ''; + while ($node = db_fetch_object($result)) { + $output .= node_view(node_load(array('nid' => $node->nid)), 1); + } + $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + } + else { + $output = t("

No content for this user

"); + } + + return $output; +} + function theme_user_picture($account) { if (variable_get('user_pictures', 0)) { if ($account->picture && file_exists($account->picture)) { @@ -719,6 +757,11 @@ $items[] = array('path' => 'user/'. arg(1) .'/delete', 'title' => t('delete'), 'callback' => 'user_edit', 'access' => $admin_access, 'type' => MENU_CALLBACK); + $items[] = array('path' => 'user/'. arg(1) .'/content', 'title' => t('user content'), + 'callback' => 'user_nodes', + 'callback arguments' => array(arg(1), arg(3)), + 'access' => user_access('access content'), + 'type' => MENU_SUGGESTED_ITEM); if (arg(2) == 'edit') { if (($categories = _user_categories()) && (count($categories) > 1)) {