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

Status:Active» Fixed

Unfortunately 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.

Thanks for your reply. I've now changed the custom text field to use the PHP code option and entered the following...

<?php if (!$logged_in) : ?>Register<?php endif; ?> <?php if ($logged_in) : ?><a href="node/add/topic?field_topic_reference=%1?destination=%1">Add topic</a><?php endif; ?>

...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.

Status:Fixed» Active