How to show a global text message publicly but hidden for logged in users

Such a scenario might include cases when you need to show a public message intended for users to signup and register to avail restricted contents, such as:

  • Register to View Contents
  • Become a Member to Download Contents
  • and similar use cases

Steps to restrict your Views page and contents :

  1. Configure your Views to restrict the page and contents to the public (hiding it from public view, accessible only to registered users/members or certain roles). See also article to do this here http://www.knowledgebase.ibuild.ph/drupal-7-views-how-restrict-views-page-and-contents-taxonomy-term-role-provide-global-text-message 
     
  2. Next, you need to install Views Role Based Global Text module
    https://www.drupal.org/project/views_role_based_global_text
     
  3. Install and configure. There is a "Role" setting while entering text either on header or footer.

No Results Behavior

Since you will need the same public global text message hidden upon log-in, you will need to set this viewable only for anonymous users/role.

  1. Under the advanced settings in your View, Add a Global Text are under No Results Behaviour, then
     
  2. Select only anonymous user. This will make this global text message appear publicly even with the Views content hidden, and the same global text message disappear when the user is already logged in.

See also related article  Drupal 7 Views - How to restrict views page and contents by taxonomy term role, but provide a global text message publicly

Leave a Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Get reliable web hosting services

Recurring donation

Make Donation

  • Other: $

Donate now

Single donation

Make Donation

  • Other: $

Donate now