- Issue created by @Bohus Ulrych
- First commit to issue fork.
- π«π·France m.anoune
m.anoune β made their first commit to this issueβs fork.
- π«π·France m.anoune
m.anoune β changed the visibility of the branch 8.x-1.x to hidden.
- Merge request !14[Issue #3425701/] Fix for accessing unpublished node translations by using... β (Open) created by m.anoune
- π¨πΏCzech Republic Bohus Ulrych Pilsen (Czechia)
Hello,
MR 14 generates errorThe website encountered an unexpected error. Please try again later. Error: Class 'AccessResult' not found in unpublished_node_permissions_node_access() (line 67 of modules/contrib/unpublished_node_permissions/unpublished_node_permissions.module).
After adding missing line
use Drupal\Core\Access\AccessResult;
it seems that it works and solved the problem with translations.Thanks
- Status changed to Needs review
10 months ago 9:59am 12 March 2024 - Status changed to Needs work
10 months ago 10:06am 12 March 2024 - πΊπ¦Ukraine AstonVictor
It'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;
- it makes no sense to removeunpublished_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...
- π§πͺBelgium jurgenr
We'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.
I 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 on the node_access table in the database.
- πͺπΈSpain ipitbiz
Hello,
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, - πͺπΈSpain ipitbiz
Hello again,
Sorry, I realized that my difference is due to the fact that I have the patch applied as well:
https://www.drupal.org/files/issues/2024-03-11/3427115-2.patch β
I don't know if the same thing can happen to anyone.
- πͺπΈSpain ipitbiz
The final patch that fixes both problems. The reason is that gid cannot be null.
- π©πͺGermany quotientix
Patch doesn't work for me. This makes the module unusable for me -.-