in drupal 7 - I have given a role the permissions to edit, add delete and modify content but he doesn't see the authored date in order to modify it. how can I give him permissions to modify that ?
1 Answer
Updated date is set automatically by the system, if you want to edit that you will need to write some custom code. Your user should be able to see the 'authored date' though.
Alternatively, if you need a date field that the user can edit (say, a publication date), just create a date field on your content and render it appropriately.
[edit based on additional info]:
I went digging in the code and found this in node.pages.inc:
$form['author'] = array(
'#type' => 'fieldset',
'#access' => user_access('administer nodes'),
'#title' => t('Authoring information'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
'#attributes' => array(
'class' => array('node-form-author'),
),
'#attached' => array(
'js' => array(
drupal_get_path('module', 'node') . '/node.js',
array(
'type' => 'setting',
'data' => array('anonymous' => variable_get('anonymous', t('Anonymous'))),
),
),
),
'#weight' => 90,
);
As you can see, access is tied to the 'administer nodes' permission which I'm guessing you haven't, and probably don't want to give to that role.
Luckily this is quite easy to change using hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
, here's the API for that function.
Create a custom module and put this in it:
function MODULENAME_form_node_form_alter(&$form, &$form_state, $form_id){
// You may wish to add some logic here to test for a specific role
$form['author']['#access'] = TRUE;
// Otherwise this will simply give everyone who can create nodes the
// ability to change author and date.
}
-
Hi, that is the date I want him to see (the authored date) but it's not visible to him (I can see it when I edit as an admin though)– DianaMar 19, 2015 at 12:58
-