Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.415 diff -u -r1.415 user.module --- modules/user.module 15 Nov 2004 11:16:39 -0000 1.415 +++ modules/user.module 18 Nov 2004 03:39:12 -0000 @@ -685,6 +685,15 @@ $items[] = array('path' => 'admin/user/configure/permission', 'title' => t('permissions'), 'callback' => 'user_configure', 'access' => $access, 'type' => MENU_LOCAL_TASK); + foreach (node_list() as $type) { + if (node_access("create", $type, $user->uid)) { + $items[] = array('path' => 'user/'. arg(1) .'/unpublished', + 'title' => t('unpublished'), 'callback' => 'user_unpublished', + 'access' => $access || $user->uid == arg(1), + 'type' => MENU_LOCAL_TASK); + break; + } + } if (module_exist('search')) { $items[] = array('path' => 'admin/user/search', 'title' => t('search'), @@ -1195,6 +1204,26 @@ else { drupal_not_found(); } +} + +function user_unpublished() { + global $user; + + $result = pager_query('SELECT DISTINCT(n.nid), n.sticky, n.created FROM {node} n WHERE n.status = 0 AND n.uid = ' .$user->uid .' ORDER BY n.sticky DESC, n.created DESC', variable_get('default_nodes_main', 10)); + + 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 unpublished content'); + } + print theme('page', $output, t('unpublished content')); } function user_page() {