Major limitation of Drupal? no draft mode?
Similar to this node which has gone unanswered, I've got a basic requirement for my users that I don't see how to implement in core Drupal (4.7.3). I've been using Drupal for 1.5 years now. I've got a role set up for my tech site that I've called "content contributor." For my users that are "content contributors," I'd like a menu option to appear on their menus when the log-in called "content" (just like admin "content" menu) except that I'd like them to be able to edit their own content only. This would work for unpublished content as well. This essentially would be a "draft mode" for non-admin, non-anonymous users. It could also appear as "admin > content" but would only show content for the specific user.
Wordpress supports this feature OOTB, allowing users to save drafts of post and manage drafts. Additionally I'd like to be able to deny "Delete" permissions, only edit a node once it has been created.
Granting "administer nodes" to my "Content contributor" role does not make sense since it grants *everything*, including delete, and much more. I'm very surprised that in the core Drupal functionality there is really no way of accomplishing this, so perhaps I'm missing something here?

wouldnt this require an
wouldnt this require an action in the actions module ? action create draft ?
Views module
and some access control settings should get you there.
See http://drupal.org/node/84395#comment-154442
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
Trying out views
Thanks Steven. I'll try out the views module later today.
Handbook PHP snippet could do it but...
Hello Steven. This handbook page is what I'm looking for but it suffers from the same basic core problem: How can users edit unpublished content without "administer nodes" privilege?! this is something I've been struggling to understand since day 1 of using Drupal.
I *was* able to implement a block that checks current user > published AND story content "in moderation" and displays the titles as links. *However* this makes me dependent on the "Views" module and I would like to remove this dependency in favor of this handbook PHP snippet, but I don't know if Drupal can even handle my use case.
I want to have unpublished content that "Writers" can edit (e.g. they get the "edit" tab). Using this PHP snippet now against my 4.7.3 installation, "writers" (no administer nodes privilege) can see the links to the nodes, but when I click on them, I cannot edit them due to access control. Can Drupal even handle editing of unpublished nodes for non-admin users?
I hope you can help here, this is something that continues to frustrate me.
A temporary and simple hack for saving nodes as drafts
Have seen several discussions of this much needed feature. I implemented a hack in the node.module to allow any authenticated users to set publishing options (published, front page) and to access 'unpublished' nodes to change the options. Then I made a page that simply shows a list of unpublished nodes for the currently logged on user.
Here are the changes in node.module (all changes between /* MOD ... END MOD */ comments)...
In node_submit:
// Force defaults in case people modify the form:/* MOD: Removed following
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
if (!$access || !isset($node->$key)) {
$node->$key = in_array($key, $node_options);
}
}
END MOD */
In node_form_array:
// Put all of these through as values if the user doesn't have access to them.foreach (array('uid', 'created') as $key) {
$form[$key] = array('#type' => 'value', '#value' => $node->$key);
}
/* MOD */
// Node options for authenticated users
$form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25);
$form['options']['status'] = array('#type' => 'checkbox', '#title' => t('Published'), '#default_value' => $node->status);
$form['options']['promote'] = array('#type' => 'checkbox', '#title' => t('Promoted to front page'), '#default_value' => $node->promote);
/* END MOD */
In node_access:
function node_access($op, $node = NULL, $uid = NULL) {/* MOD */
global $user;
/* END MOD */
Also in node_access:
// Convert the node to an object if necessary:if ($op != 'create') {
$node = (object)$node;
}
/* MOD */
// If node created by this user, let them see/change it
if ($op == 'view' && $node->uid == $user->uid) {
return TRUE;
}
if ($op == 'update' && $node->uid == $user->uid) {
return TRUE;
}
if ($op == 'delete' && $node->uid == $user->uid) {
return TRUE;
}
/* END MOD */
This effectively allows any user to view/update/delete their own nodes, even if unpublished.
Then I created a "page" type node with a simple list of the current user's unpublished nodes:
<?phpglobal $user;
$items = array();
$sql = 'SELECT n.nid, n.uid, n.title, n.status, u.name FROM {node} n INNER JOIN {users} u
ON n.uid = u.uid WHERE n.status = 0 AND n.uid = ' . $user->uid ;
$sql = db_rewrite_sql($sql);
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
$n = $row->name;
$items[] = l($row->title, 'node/'. $row->nid) ;
}
if ($n == '') {
print "No draft items found." ;
}
else {
print "Draft items for " . $n . ":<br><br>" ;
print theme('item_list', $items);
}
?>
If anyone can think of any security issues with this please let me know. (I have "edit own" access control turned on for authenticated users for appropriate content such as blogs, pages, and images, so this seems to just sort of extend that a little.)
P.S. If someone wanted to make the 'My Drafts' page PHP code into a module, that would be great!
Hi, I have been using Drupal
Hi,
I have been using Drupal 5.1 for little over 2 months. I also would like to allow authenticated users to administer their own nodes, especially unpublished nodes. Were you able to find a solution?
Thanks.
Private module
I'm not aware of any stable or supported modules that have "Save as Draft" functionality. What I suggest is that you install the Private module and then use Locale to change the text from "Private" to "Draft".
Private Is the Way, the truth, the ...
Private is the way to go if you want users to be able to save a draft. Private should be renamed Draft and it perhaps would gain rapid fame.
That module is unnecessary. Open up the private.module and scroll down to line 151. Change the word Private to draft.
'#title' => t('Private'),TO
'#title' => t('Draft'),=-=
While the above is true, hacking a module in this fashion is not a best practice. When the module is updated the changes will need to be made again.
That being said, the locale.module is the proper/drupal way to change text strings and allows these types of changes to remain active after an update of a module or core for that matter.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Your absolutely correct
Your absolutely correct here. It's a bad habit of mine. It's just so easy to pop open the text editor and change things to suit my needs. =)
Workflow module to control node status
Hi,
Not quite sure what limitations there might be in Drupal 4.x, but I've been using the Workflow module (http://drupal.org/project/workflow) to do something similar on a 5.x site. Different roles can move nodes between different states. So, for example, contributors can only create nodes and set them as drafts, while a user from the 'editor' role can make changes and mark nodes as published. The built-in access control in Drupal means that contributors only see their own draft nodes, while the editors can see all nodes, whether published or not.
One thing I haven't played with yet is dealing with draft revisions - i.e. saving new changes as a draft but keeping the previous revision published. But it looks like this module (http://drupal.org/project/revision_moderation) will deal with that.
Matthew