Display various content for anonymous and registered users

I need to do the following:

  • If an anonymous user visits the site, show its contents.

  • If the user logs on to the site, instead of the usual content, content related to the user appears.

I would like to accomplish this using the Views module.

I looked at the Premium module, but it seems to be left behind. I would like to avoid using a content access module, if at all possible, since I already have other access controls.

+6
drupal drupal-6
source share
2 answers

If you create a page display for views, you can accomplish this using access controls. The first available screen that the user has permissions appears in the view.

  • Creating a Mapping for an Authenticated Custom View
    • Set the path to the page
    • Set access restrictions (for example, using an authenticated role)
  • Create a display for anonymous viewing by a user
    • Set the page path to the same value
    • Optionally deny access to an anonymous role (optional, because if views can load an authenticated display for the user, he will not worry about it, but may contain it explicitly)

Since you cannot reorder impressions in a view (for now), you must define the views in order of greatest restriction to least restriction.


For more complex displays, you can use Panels Pages to render the page in different ways based on the role of the user.

If you want to distinguish between anonymous and authenticated users, you can specify that different blocks of content are visible for each role.

On my own site, I needed to distinguish between administrators and everyone else, so I could not use the role of an authenticated user to determine access for individual elements. Like Views, with the help of panel pages, you can define several variations of pages that use the same path. Administrators have access to the first option, and all other users switch to using the second.

+5
source share

You can try using CCK content permissions and setting permissions for each field. Then enter different fields for the other content you want to publish. I believe this is included in the CCK module.

+1
source share

All Articles