Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the admin has not save the content type edit forms after installing this module then there will be a permission for every content even though they will not have publish button enabled.
This is because
// First we need to check if there are a publish button for the content
// type.
if (variable_get('publish_button_content_type_' . $type->type, TRUE)) {
This value defaults to NULL when determining whether a button should be shown
if (variable_get('publish_button_content_type_' . $form['#node']->type) == TRUE) {
Here is a patch
Comment | File | Size | Author |
---|---|---|---|
publish_button-default_false_4_permissions.patch | 649 bytes | tedbow |
Comments
Comment #1
MiSc CreditAttribution: MiSc commentedSorry for my lack of response, tested!
Comment #2
MiSc CreditAttribution: MiSc commentedAnd committed to latest dev :-)
Comment #4
coredumperror CreditAttribution: coredumperror commentedThis fix broke Features which have saved publish button permissions.
Because
publish_button_permission()
only defines a content type's publish button permission if that content type has been saved with that option enabled, anything external to Publish Button which cares about that permission will get screwed if the permission suddenly vanishes.I haven't found any evidence of best practices to support this feeling, but I don't think that it's a good idea to use conditionally defined permissions. If your module could define a permission, it should always define it, so that external things like Features don't barf if your module suddenly stops defining the permission.
Comment #5
MiSc CreditAttribution: MiSc commented@coredumperror, seems like a good point. I think it over.
Comment #6
MiSc CreditAttribution: MiSc commentedI decided to stay with the fix, permissions that are not used should not be in the permissions in the first place. Please reopen if this seems totally wrong.
Comment #6.0
MiSc CreditAttribution: MiSc commentedjust fixed grammar