Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By pingu2k4 on
Hi.
i have a memberlist, created in views. I want to have a column for user roles, which i nly want to display to those from admin or mod role. i dont want authenticaed users or anonymous users to be able to see user roles.
i cant find anything in permissions... how do i do that? (i want anon users and authenticated to be able to see memberlist just without that column)
Comments
It might be easiest to create
It might be easiest to create two versions of the view - one with and one without the roles - and display it to anon/authenticated users as appropriate.
would i be able to display
would i be able to display them through the same URL? if so how do i get it to show one depending on their role?
Okay - this is a real kludge
Okay - this is a real kludge and I'm sure someone else can come up with a more elegant solution, but it'll work.
1. Choose a theme which allows blocks at the top or bottom of the content area
2. Create a page in which you'll display the view - it'll need a title and you can use the body field to enter any additional text if you want.
3. Make two "block" displays of the view
- one with the role column, visible only to authenticated users (in Basic Settings for the view)
- one without the role column, visible only to anonymous users
- make both of them visible only in the page you created
4. In the block admin, allocate both blocks to the page you created
You can now open the page, and it'll display one of the two blocks, depending on whether you're logged in or not.