Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.383 diff -u -r1.383 user.module --- modules/user.module 27 Aug 2004 22:52:00 -0000 1.383 +++ modules/user.module 7 Sep 2004 00:59:20 -0000 @@ -600,6 +600,15 @@ $items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'), 'callback' => 'user_edit', 'access' => $access || $user->uid == arg(1), 'type' => MENU_LOCAL_TASK); + foreach (node_list() as $type) { + if (node_access($type, "create")) { + $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 (arg(2) == 'edit') { if (($categories = _user_categories()) && (count($categories) > 1)) { @@ -1161,6 +1170,26 @@ } } +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() { $edit = $_POST['edit']; $op = $_POST['op'];