Private Unpublished Content
PLEASE NOTE These snippets are 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.
The following snippet lists the headlines of all the unpublished posts of the currently logged in user. The snippet is tested with Drupal 4.6.3.
<?php
global $user;
$listlength='20';
$curUserId=$user->uid;
$res = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.status = 0 AND n.uid='$curUserId' ORDER BY n.created DESC"), 0, $listlength);
if (!db_num_rows($res)) {
$output = t("You don't have unpublished content.");
} else {
$output = node_title_list($res);
}
print $output;
?>And this is what you need to copy and modify if you want to filter and list unpublished content only under specific content types.
<?php
global $user;
$listlength='20';
$nodetypes="('blog', 'story')"; // <-- define you content types here
$curUserId=$user->uid;
$res = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE *n.type IN $nodetypes AND n.status = 0 AND n.uid='$curUserId' ORDER BY n.created DESC"), 0, $listlength);
if (!db_num_rows($res)) {
$output = t("You don't have unpublished content.");
} else {
$output = node_title_list($res);
}
print $output;
?>Good luck!

can't edit the node though
Hello. I really want to implement this for my users. I'm currently doing something very similar with the Views module, basically providing a block. The problem is though, I don't see how to setup Drupal to give users "edit" persmission on a node without making the node published OR without giving them "administer nodes" privilege. basically I want my "writers" to write content and edit their own content, but I want my "editors" to approve and "publish" the content. I think this is either a major shortcoming of Drupal or I am missing something critical here. What is the point of unpublished content if it can not be edited by the content creator.
Note: if you'd like to help me, I can set you up with a test account at my site and show you what I mean or provide more specific information. Please also refer to this node for further discussion.