0

This question already has an answer here:

I want to hide the left tool bar of content type also revision message box, as shown in attachement, for non admin people.

I have gone through following https://www.drupal.org/node/1276698 but it's only for particular content.

Please suggest me how to hide from all content.

enter image description here

marked as duplicate by Clive Oct 6 '15 at 7:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

in yourwebsite.com/admin/people/permissions check that the following permission are unchecked under Node (click image to enlarge)

enter image description here

Edit: I did testing, and it's the Administer Content, make sure you uncheck it! Also administer content types as you don't want them to have that either.

  • if i uncheck all of those, authenticated user[non admin] cannot able to create content, i want them to create but only thing i just want to hide that tool bar for non admin, though they can create content. – rose Oct 6 '15 at 7:41
  • @rose you see the 2nd last row on my screenshot that says Article Create new Content, u need to check mark that one, also for Edit and Delete own content, if you want to allow them to do that as well. – No Sssweat Oct 6 '15 at 8:30
  • I assume its the Article content type, if it's for another content type it should be listed further down. – No Sssweat Oct 6 '15 at 8:37
  • @rose, one last thing. make sure you allowed them edit and delete own content and not any content. With any content they can edit or delete anyone else content and you may not want that. – No Sssweat Oct 6 '15 at 9:01
1

Answer according updated question:

Use this function in template.php.

/**
 * Implements hook_form_alter().
 */
function THEMENAME_form_alter(&$form, &$form_state, $form_id) {

  global $user;
  $is_administrator = in_array('administrator', array_values($user->roles));

  if($form_id == 'my_form_id'){
    // if $user does NOT have the administrator role.
    if (!$is_administrator) {
      // disable vertical tabs for this form
      form_disable_vertical_tabs($form);
    }
  }
}

Answer before updating question:

You may use this snippet in page.tpl of your currently active theme.

global $user;
$roleid = paste_role_id_of_admin; //
if(user_has_role($roleid, $user)) {
  <?php print $sidebar_first; ?>
}

OR

if($is_admin){
  <?php print $sidebar_first; ?>
}
  • where exactly i can add this above code, in which function? – rose Oct 6 '15 at 7:05
  • In no function. In your page.tpl.php in your current theme. – Huelfe Oct 6 '15 at 7:13
0

Maybe you want to look at the Simplify module for this. Here is a quote from its project page:

Simplify allows particular fields to be hidden from the user interface. This helps to de-clutter forms and present a more user-friendly experience to content editors.

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