0

I would like to change node content under some specific URL aliases after the user logs in, to show some other contents for authenticated users.
With a really simple example, there's a node which can be reached under the URL alias http://<mysite>/something, and this content contains the string "You have to be logged in, because this would be good to you", but after logging in, the same URL alias would show "OK, now you're logged in".

Another user wrote here that

"in views we can setup same url for different views that is one for anonymous and another for registered."

Is this the right solution?
If yes, how should I do this in practice?
If no, what else can you suggest?

Thank you in advance!

2 Answers 2

2

You can do this with views using the technique in this blog post: Making a view show different content to different users based on role

6
  • thanks, this sounds good, now I created a view with different roles as in the attached example (on the linked site) on a specific page of mine, and set "Node translation: Translation set node ID" filter for a given ID, because I have a multilingual site. I created another page with translations for the logged in view too, and set this ID for authenticated users (and admin). This works, so this shows a different content after logging in. Does this approach sound good? Another question is how to restrict access for the view I just want to show after logging in. Can you answer that too? :)
    – Sk8erPeter
    Aug 9, 2011 at 20:17
  • Oh, and my big problem with this approach is that this way I lose the "Edit" tab link for logged in users... Do I have the opportunity to query node content the way that it can also be edited "in place" as in "normal" nodes (pages)?
    – Sk8erPeter
    Aug 9, 2011 at 20:23
  • rfay,so, don't you know the answer to let the Edit tab appear in Views? :$ :)
    – Sk8erPeter
    Aug 16, 2011 at 13:32
  • Thanks, I finally accepted your answer (sorry for not doing it so long). I have to mention that the same can also be done with Panels module. Maybe it's even more simpler.
    – Sk8erPeter
    Apr 11, 2012 at 22:32
  • I do not know how to make the edit tab appear in views. Probably should be a separate request, for success.
    – rfay
    Apr 12, 2012 at 23:37
1

If you want to use views to do that, then the previously mentioned links are good examples.

You might also take a look at Restricted Text and Block CPR (Content Per Role) modules. Each module allows you to show separate content based on role. The former will do this anywhere you can set an input format and the latter is just for blocks.

1
  • Thanks, this sounds good too! My problem is that this way I don't have the opportunity to separate static content that can be edited by a given authenticated user in a WYSIWYG editor, and the dynamic PHP content that can only be edited by an administrator. But you got a vote up, because these are very useful modules too! Maybe I will use them too.
    – Sk8erPeter
    Aug 9, 2011 at 20:33

Your Answer

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

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