Download & Extend

Don't take into account defaults parameters

Project:Override Node Options
Version:6.x-1.4
Component:Code
Category:bug report
Priority:critical
Assigned:fab65
Status:closed (fixed)

Issue Summary

Hello,
If I set publish and promote like parameter for content type and I give access to override publish option (but not override promote option), there is an issue. When I create a new node and save, the promote option isn't take into account.
I think bug comes to override_node_options_form_alter() funtion.
You override $form['options'], so the status, promote ... options dissapear. After, if the user have access to override X option, you add it (for example, if user have access to override publish option, you add $form['options']['override_publishing_status'] with goods parameters). But the others parameters are lost (promote option for example).
I don't know if you understand me because my english is bad but I'm hope it will be good :).
Can you tell me if a patch can be doing quikly?
Thank you.

Comments

#1

Sorry I don't understand the issue.

If you enable publish and promote in the content type, you will also have to enable both of the override permissions for the roles you want to access these.

#2

Let's say I set the default Promote to Front Page field for a content-type to checked. And that I don't allow anyone to override that particular field (Override xxx promote to front page option is unchecked). To me, that means I always want that particular content type to be promoted to the front page and I don't want anyone to change that default. Instead, the default for the content-type is ignored and no entry of that type is promoted to the front page.

#3

It's exactly that. The default option for the content-type is ignored (see description issue for explication). I need a patch quickly. Can I get one please?

Thank you

#4

I will try to look into this, this week, but I can't promise anything. :)

#5

Thank you very much.
I want to use this module for a project enterprise but i can't if i don't have this patch and, normally, I must show my project the next week :).

#6

Here is a patch I did for my 5.x system. I have also include the 6.x version, but I have not tested it out. It looks like this area of the code hasn't changed so I think it will work. What I did was to use a hidden field to pass the checkbox values if the user was not allowed to change them. I didn't add anything for the authoring because it looked like a blank/missing field would work fine and you can't really set a default for those values like you can for the checkboxes.

AttachmentSize
override_node_options_403630.patch 2.58 KB
override_node_options_403630_6.patch 2.58 KB

#7

I can see this would work and would be a good *short term* fix, but by making the fields hidden, they are still editable using something like FireBug.

I was thinking of adding something to check if it's a default before doing anything, but I will try and look into it tonight.

#8

Effectively, it's may be not a best solution but it's a beginning :).
In fact, I think it don't ovverride $form['options'] without saving options before.

After I apply patch, I remark an other issue with preview. When you click on preview, option publish is always unchecked (and others options too).

The problem is due to deletion of $form['options']['status'] (and the others) and creation of
$form['options']['override_publishing_status'] (and the others in function of permissions).
When I want preview my result, the form is alter again but it doesn't exist $node->status (value put by default). So null is put.

Why do you create differente name options (ie you put 'override_publishing_status' to replace 'status') ? Can you use same name option and just alter access ?
For example you can write :

if(user_access('override ' . $form['type']['#value'] . ' published option')){
      $type = 'checkbox';
    } else {
      $type = 'hidden';
    }
   $form['options']['status'] = array(
        '#type' => $type,
        '#title' => t('Published'),
        '#default_value' => $node->status,
     );

instead of :

   if(user_access('override ' . $form['type']['#value'] . ' published option')){
      $type = 'checkbox';
    } else {
      $type = 'hidden';
    }
    $form['options']['override_publishing_status']   = array(
          '#type' => $type,
          '#title' => t('Published'),
          '#default_value' => $node->status);

Like that, variable $node->status always exist.

Thanks you for your answers

#9

Status:active» needs review

I have created a patch that applies the default settings if the override hasn't been set, without using hidden fields.

please review, it works, but I think I can find a better way.

AttachmentSize
ono.patch 970 bytes

#10

Status:needs review» fixed

committed

#11

I get a slightly different behavior now. I have a role with override story promote to front page option and override story sticky option checked. The Published and Promote to front page options are checked by default for a story.

Now, if create a story and uncheck promote to front page and submit, the story is still promoted to the front page.

#12

serves me right for not fully testing, sorry. :)

fix in version 6.x-1.6

#13

Status:fixed» active

Thank you for the new version. It's better.
But I have an another issue.
I allow users to override only status option. When an user create a node, if he check status option and click on "Preview", the status option is unchecked (but it's ok when we click on button "Save").
Can you explain me please?
Thank you

#14

Status:active» fixed

This issue has been raised
#404996: Node preview resets changed fields to the default value

A patch was submitted, and committed, I will look into why it's not working.

Please add follow up comments in the other issue.

#15

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here