1

I created a Search on my website with views exposed filters. I want only the logged in users to view the entire content. So, when the user clicks on View More.. Link I want them to be redirected to the log in page or pop up a login block.

Thanks, Prerna

2
  • how you are showing view more link, by custom field or anything else? Commented Dec 7, 2012 at 10:00
  • What happens when an authenticated user clicks the 'Read More'? It is a link to the article's node or is. It a JS that expands the content? I have a few ideas how to simply achieve what you need..
    – rreiss
    Commented Aug 18, 2013 at 7:50

3 Answers 3

1

In your view set the Access of the page display to role > authenticated user. This will present an Access Denied message to anonymous users.

You can then enable the Login Toboggan module and enable "Present login for on access denied (403)". After the user logs in, they will be taken back to the view page automatically.

0

In your view's page display add PHP header like this:

<?php
  if (user_is_anonymous())
    drupal_goto('user/login');
?>
1
  • Thanks for the reply, But in both the cases by rocketeerbkw and Jan, the search results would never be displayed and they would be redirected to login page. But what I am looking for is for the search to be displayed but then when a link to full node is clicked i.e. "View More.. " in my case I want at that time for the users to be redirected to login page..
    – Prens
    Commented Aug 9, 2011 at 18:01
0

The simplest way I can think of is to use an access control module like Content Access. In Content Access you can set the permissions for accessing a node on a node by node basis, it is very flexible. You can set it up so that the content type you are using is viewable by authenticated users only by default.

Then you can use @rocketeerbkw recommendation of LobinToboggan to automatically show the user login form on 403 pages.

Your view will then link to the actual page that you want users to get to, but they won't be able to access it until they log in on that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.