Closed (fixed)
Project:
Unpublished Node Permissions
Version:
8.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2024 at 10:46 UTC
Updated:
25 Mar 2026 at 16:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #6
bohus ulrychHello,
MR 14 generates error
After adding missing line
use Drupal\Core\Access\AccessResult;it seems that it works and solved the problem with translations.
Thanks
Comment #7
m.anoune commentedComment #8
astonvictor commentedIt's incorrect to fix it in that way:
- hook_entity_access doesn't work with queries and autocomplete fields. So, your changes create new bugs in other places;
- it makes no sense to remove
unpublished_node_permissions_node_grants()but still useunpublished_node_permissions_node_access_records()and rebuild node grants on module install.you can check the difference between access hooks here - https://api.drupal.org/api/drupal/core%21modules%21node%21node.module/gr...
Comment #9
bohus ulrychYes, now it works!
Comment #10
jurgenr commentedWe've had the same issue here and moved to https://www.drupal.org/project/view_unpublished. That module does exacly the same thing, and is more globally used than this one.
Comment #11
rsayago commentedI have been working on a patch to fix this issue. We have been testing and it seems to works fine. With this patch, the permissions are saved right for each translations on the node_access table in the database. This patch is to 8.x-1.4 version.
Comment #12
rsayago commentedThis patch is to 8.x-1.5 version.
Comment #13
ipitbiz commentedHello,
I add a small change in the patch because the code of version 1.5 changes a little. Instead of:
'realm' => 'view_unpublished_author',
'gid' => $node->getOwnerId(),
I have:
'realm' => 'view_unpublished_author',
'gid' => $node->getOwnerId() ?? 1,
Comment #14
ipitbiz commentedHello again,
Sorry, I realized that my difference is due to the fact that I have this patch applied also:
https://www.drupal.org/files/issues/2024-03-11/3427115-2.patch
I don't know if the same thing can happen to anyone.
Comment #15
ipitbiz commentedThe final patch that fixes both problems. The reason is that gid cannot be null.
Comment #16
quotientix commentedPatch doesn't work for me. This makes the module unusable for me -.-
Comment #17
jksloan2974 commentedYou have to rebuild permissions after you apply the patch
Comment #18
papagrandeI ran into this problem as well. I fixed it by swapping in the https://www.drupal.org/project/view_unpublished module. Thanks, @jurgenr.
Given the lack of attention to this issue and module and the far lower number of sites using it, I suggest the module be abandoned and sites migrate to view_unpublished.
Comment #19
fabsgugu commented