Posted by H-BES on March 23, 2010 at 2:39pm
4 followers
Jump to:
| Project: | Publish Content |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
With Node Publish Module (http://drupal.org/project/publishcontent) enabled also if i grant "promote to front page" to a role in the new node form the promote to front page checkbox does not appear.
With Publish Content Module everythings is ok, which module is guilty?
Saluti
BES
Comments
#1
The Noe Publish module is at fault because it unsets the form elements instead of using $form['access'].
152 function publishcontent_form_alter(&$form, $form_state, $form_id) {
153 if (!user_access('administer nodes')
154 && $form['type']['#value'] .'_node_form' == $form_id
155 && (_publishcontent_unpublish_access($form['#node']) ||
156 _publishcontent_publish_access($form['#node']))) {
157 $form['options']['#access'] = TRUE;
158 unset($form['options']['promote']);
159 unset($form['options']['sticky']);
160 unset($form['options']['revision']);
161 }
162 }
<code>
Should be more something like:
<code>$form['options']['#access'] |= _publishcontent_unpublish_access($form['#node']) || _publishcontent_publish_access($form['#node'])
#2
#454660: not keeping defaults: for other publishing options , the patch in #5 addresses Dave Reid's points.
Here are the relevant chunks:
Explicitly set the access to the "status" checkbox:
$form['options']['status']['#access'] = TRUE;If access to the options fieldset is already set to TRUE, we don't need to muss with the rest of the form - break here:
if ($form['options']['#access']) {return;
}
If access to the options fieldset is NOT set to TRUE already, we need to set it, AND we need to make sure that restricted users don't have access to its children elements.
else {$form['options']['#access'] = TRUE;
}
For each element child, if
#accessis explicitly set, do not change it.Otherwise, assign it
FALSE.foreach (element_children($form['options']) as $key) {// If another form has afforded access to a particular option, do not
// override that access. Otherwise, disable it.
$form['options'][$key]['#access'] =
isset($form['options'][$key]['#access'])
? $form['options'][$key]['#access'] : FALSE;
}
}
I've verified the reported issue and verified that it's fixed using the patch above.
Please re-activate if the patch above does NOT address the issue for you.
Postponing pending commit of referenced patch.
#3
Closing since the patch described above was committed.
Please reopen if this issue persists for you
#4
Automatically closed -- issue fixed for 2 weeks with no activity.