I have four content types on my site that registered users can create, but they are set to be approved by admins before publishing. Since the site also sends out notifications to subscribers when a new node is created, the following problem occurred - the regular users could save new nodes which are not published until approval, but the notifications go out immediately after they save it anyway.

The registered users creating new nodes must not have the ability to create i.e. save the node and that's why we added the "Save as draft" option (via Save Draft module). What I need is to only show the "Save as draft" button, possibly under another label and completely hide the "Save" button. Understandingly, I would need to do this only if the user is not an admin or an editor, otherwise I might create a big confusion on the site.

This is the rule which sends notifications to users who subscribed for notifications:

{ "rules_new_content_notifications" : {
    "LABEL" : "New content notifications",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--slucaj_plan" : { "bundle" : "slucaj_plan" },
      "node_insert--inicijativa" : { "bundle" : "inicijativa" },
      "node_insert--izgradnja" : { "bundle" : "izgradnja" },
      "node_insert--projekat" : { "bundle" : "projekat" } },
    "DO" : [
      { "mail_to_users_of_role" : {
          "roles" : { "value" : { "8" : "8" } },
          "subject" : "New content created",
          "message" : "..."

The content approval module only sets the node to "unpublished" after a non-admin saves it and the way the administrators approve it later is to edit it and set as "published".

  • I think we have XY case here. You have problem X, and you think Y is a solution, so ask how to achieve Y. In this case I would solve this problem by changing rules that sends notifications, to send them on moderation->accept, not on save. But this, of course, does not answer your question as written.
    – Mołot
    Apr 29, 2014 at 11:03
  • This question appears to be off-topic because it is about code you wrote, for which you want to write better code, but you did not show the code you are using, or the part of the code that is relevant for the question. If you implemented it by means other than own code, you should post list of modules involved and appropriate parts of configuration instead.
    – Mołot
    Apr 29, 2014 at 11:05
  • I didn't write any code, I set up the notifications via the Rules interface. I can edit my question and add more details. The thing is, a vast majority of these nodes get created by admins and publishers, the user-created nodes are just a newly added feature.
    – alouette
    Apr 29, 2014 at 11:21
  • You can export rules and include code of the rules you are using, can't you? Also, why don't you tag your question with rules to make it clear?
    – Mołot
    Apr 29, 2014 at 11:29
  • 1
    This question is confusing. What does a rule that sends notifications have to do with re-labelling save buttons? Or am I missing something? Also, what module are you using to provide the save draft functionality (there are multiple and which one it is directly affects how you change the label).
    – rooby
    Apr 29, 2014 at 11:58

1 Answer 1


Focusing just on the save draft module (whatever rules you are using are unrelated).

You can implement a custom module will the following form alteration:

 * Implements hook_form_BASE_FORM_alter().
function MODULENAME_form_node_form_alter(&$form, &$form_state, $form_id) {
  // Get the current user object.
  global $user;
  // Role ids of the current user.
  $user_roles = array_keys($user->roles);
  // Role ids of your admin roles.
  // Change these to suite your role ids.
  $admin_roles = array(8, 9);

  // For users that don't have the appropriate roles.
  if (!array_intersect_key($user_roles, $admin_roles)) {
    // Restrict access to the save button.
    $form['actions']['submit']['#access'] = FALSE;
    // Change label of save draft button if it is present on this
    // content type.
    if (isset($form['actions']['draft'])) {
      $form['actions']['draft']['#value'] = t('Save as draft button label');

For this to work your module's form alter function needs to run after the save draft module.
To achieve this you need to either add an install function that changes the weight of your module in the system database table so that it is 1 (save draft is 0 so you need a higher number), or you can implement hook_module_implements_alter() to make your form alter hook run after.

For more information on making your form alter run after the save draft form alter see the two answers at How can I modify the advanced search form when my hook runs too early? - these explain how to do both the solutions I mentioned above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.