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.
In my use case I would like to be able to display a node reference (just the teaser) even if the user doesn't have permission to view the full node. Of course if I could display the whole node then I can use the cck display format to only display the teaser. I am looking through the code to see how this might be possible.
Any ideas?
Comments
Comment #1
webservant316 CreditAttribution: webservant316 commentedmy problem solved with this one line hack/addition. added this line to 349 of nodereference.module
Perhaps this feature could be added in a better way.
Comment #2
KarenS CreditAttribution: KarenS commentedWe're not going to add a feature that bypasses Drupal's permissions. If someone is not supposed to view the node they should not see the teaser. If you have some special use case where you want to do that it is something you will have to do yourself.
Comment #3
webservant316 CreditAttribution: webservant316 commentedFair enough, but one last thought.
You could add a Drupal perm that stands along side the node reference module that grants permission to see the contents of a referenced node even if you do not have perm to access the node directly. It could be part of the 'CCK Content Permissions' and the perm could be called 'view node reference override'. It could default to off and even when it is on admins could further control access to the content using the CCK field display options.
Solving the problem this way would not bypass the Drupal perms, but expand their capability and flexibility.
Further it is not true in all use cases that someone who cannot see the whole node should not see the teaser. In my use case I do need to ability for users to view part of the node but not the full node until access is purchased via Ubercart node access. I had two choices. 1) restrict the whole node but grant access to the teaser as I have done OR 2) grant the whole node, but restrict a particular set of fields with CCK field perms. I went with the first option because the Ubercart module to sell node access is better than the Ubercart module to sell field access.
Reconsider?