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.
Hi,
I have a view that shows a list of nodes referenced to another node. If there are none then I have the 'No results behavior' option set to display custom text. The custom text has a link which is site.com/node/add/topic, however I want to only show this to logged in users, and to logged out users I want to be able to show a link to sign in or register instead.
Can anyone explain how I can do this?
Thanks for any help.
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedUnfortunately the only 2 ways to do this are to 1) create a custom area plugin that will provide the link and check permissions, or 2) use the php filter and embed PHP directly in your view.
Comment #2
Jboo CreditAttribution: Jboo commentedThanks for your reply. I've now changed the custom text field to use the PHP code option and entered the following...
...however it seems like I've done something wrong because the PHP is being ignored and the output is:
Register Add topic
Do you know what I'm doing wrong?
Thanks again for any help, I appreciate it.
Comment #3
Jboo CreditAttribution: Jboo commentedComment #4
MustangGB CreditAttribution: MustangGB commented