Hey,
If I have a view that a user can't access, is there a method to show the view empty text, or another alternate text, as opposed to just not showing anything? Let's say they can't access the view because they aren't logged in, I could, for example, set empty text to php and print the login form.
Thanks!
Comments
Comment #1
merlinofchaos commentedYou can create two displays on the same view with the same path, and the first one that the user can access will be used. That means you should put the harder to access display first and the easier to access display second.
The easier to access display could provide filters that can never be satisfied (for example, two node type filters searching for different types) and then you could use the empty text. You should probably turn caching on for that display, too, so that the query isn't run very often. Those results will never change.
Comment #2
rc2020 commentedNice! Thanks!
Comment #3
drupov commentedHi, I'm not sure if my question belongs here.
I want to create a content pane view for node titles that have been posted into an organic group. I want to have a custom empty text that comes when there are no postings, e.g. "This group has no posts yet."
But I want also to use views agruments' validator option to check whether the user is a member of that group. If he's not a member following text should be returned: "You're not a member of that group... etc..." But as I'm already using the empty text option for the no postings case I cannot achieve that. The "Action to take if argument does not validate:" option does have some possibilites, but none such as "Display custom text", where I could write that "You're not a member"-text. This is just a static value, can this be achieved somehow?
Thanks!
Comment #4
dagmar@mitkoru: Please create another issue with your problem.
Comment #5
drupov commentedof course, issue moved here: http://drupal.org/node/653316
Sorry!
Comment #6
rc2020 commentedReopening:
I'm trying to put a bunch of views into a quicktab, and I can't seem to put multiple display ID's of the same view in the same quicktab.
Thus the ideal goal would still be to show empty text instead of the default 'you are not authorized to access this content' text. The above solution would work fine if this were a simple panels/page layout, but in more complex layouts (As in this case with quicktabs,) I don't think it will work unfortunately. I am trying the quicktabs queue to see if there's a workaround on their end, but as this use case extends past quicktabs to other areas of Drupal, I figured it would be worth a shot to get more ideas.
Thanks!
Comment #7
rc2020 commentedComment #8
dagmarSorry, you can use a PHP script to do that, or wait to Views 3 with Pluggable Areas #510284: Header/footer/empty text and more areas pluggable.
Change this behaviour in views 2 is not possible, new features will be included only in views 3.
Open a new issue if you need more help.
Comment #9
rc2020 commented@dagmar:
Yes, you are right.
Solution: Create a block. Put a PHP snippet with views_embed_view().
Works seamlessly.