What I missed the most when migrating from Wordpress to Drupal (Wordpress til Drupal
) was the draftfunction in Wordpress, I normally have a 5 or 6 ideas for a blogpost at a time and its better to start writing the post and then continue later than make a bad post just because I can't draft it.
This posts also exist in norwegian: "Kladding i Drupal"
I created forumtreads at several drupalsites (Drupal.org
, Drupal.no
og Drupalnorge.no
), but I didn't seem to find a solution that worked in a good way for blogs with more than one user or more users than thoose with administrative rights.
On this blog we wouldn't be needing anything more than the solution for singleuserblogs since we are just to persons and both have administrative rights, but I was curious to see if it was possible to make a draftfunction more or less similar to the function in Wordpress.
This how-to will be in to parts, the first will explain how to make it work for a singleuserblog and at the same time it will be the first part of how to make the draftfunction work in a multiuserblog (without having to give out all your administrative rights).
Common to both single- and multiuserblogs
The part that is in common on both single- and multiuserblogs is that you need a page to display if you have any drafts and then to link you there.
To make this page you need the Views-module.
To show the drafts one have to make a view that displays as a webpage, with a list over all unpublished posts belonging to the user that is viewing the page (if you don't feel like making the view your self you will find an view-export further down on this page that you can import).
The procedure for when you want to save something as a draft is that you enter the "Publishing Options"-menu just above the save-button and dechecks the one called "Published".
If you want to publish a draft just recheck the "Published" again and remove the date from the "Author"-menu if you want an updated date.
Just for multiuserblogs
When having a multiuserblog a new problem arrives, to give a normal user access to the "Publishing Options" you need to give the user administrative rights for all posts, something you probably would not like and this is the part I used a long time to find a solutions for.
The module that ended up solving the problem is the Override node options-module which let you give users access to the "Publishing Options"-menu without giving the administrative rights to who-knows-who.
This module is pretty straigth forward and theres nothing much to explain, but it could be advisable to take a looke at the override_node_options.module-file and comment out the options you don't want to give your normal user.
The ""Publishing Options""-menu has 4 options:
- Published
- Promoted to front page
- Sticky at top of lists
- Create new revision
By commenting out (put a # in front) the lines 28-30 and 46-48 you remove the 3 last options.
It is possible to comment out less and more than just thoose lines.
Views-export for drafts
$view = new stdClass();
$view->name = 'Drafs';
$view->description = 'List of all drafts of each user';
$view->access = array (
0 => '3',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Drafts';
$view->page_header = 'Here you see all your drafts';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = 'You have no drafts';
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'drafts/all';
$view->use_pager = TRUE;
$view->nodes_per_page = '20';
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Title',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'term_node',
'field' => 'name',
'label' => 'Categories',
'options' => 'link',
),
array (
'tablename' => 'node',
'field' => 'created',
'label' => 'Created',
'handler' => 'views_handler_field_date_small',
'sortable' => '1',
'defaultsort' => 'DESC',
),
array (
'tablename' => 'node',
'field' => 'edit',
'label' => '',
'handler' => 'views_handler_node_edit_destination',
),
array (
'tablename' => 'node',
'field' => 'delete',
'label' => '',
'handler' => 'views_handler_node_delete_destination',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '0',
),
array (
'tablename' => 'node',
'field' => 'currentuid',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, term_node);
$views[$view->name] = $view;
Links
Drupal.org
Drupal.no
Drupalnorge.no
http://drupal.org/project/override_node_options
http://drupal.org/project/views
Hi, I just read your article
Hi, I just read your article about creating drafts in Drupal. Wouldn't it be easiest to set the default publishing options not to publish a node. Then allow an editor role to review and publish the node at a later point.
That depends on the
That depends on the structure of authors on your webpage, but yes, if you have one or several authors that is "low-ranking" it would be a good idea.
One my webpage, we are two persons only and both is as much entitled to post blogposts on the page so that would just be a hazzle.