Hello :)

I wanted to add an Attendees tab for my Event pages, however I can't seem to make it work.

I created a content type named Events, used the Flag module, and created an Attendance link that shows at the bottom of every Event post. Authenticated users can then add themselves to the attendees list by clicking the said link.

Using Views, I created an Attendees page with the following settings:

View type: User
Display: Page
Relationship: Flags:User's flagged content
Arguments: (Attendance) Flags:Content ID
Fields: User: Name
Style: HTML List
Row Style: Fields
Path: node/%/attendees
Menu: Tab:Attendees

With these settings, the Attendees tab appears on each Event post successfully, alongside View l Edit. And when you click the tab, it opens up a page that displays the attendees' usernames (which is great!).

Problem is, the Attendees tab appears on other node types as well, such as the About Us pages.

I'm sure I need to configure the path settings for the page display in order to add the tab to just one specific node type (Event). However, I've tried changing it several times but to no avail. The tab disappears when I try to change node/%/attendees to something else.

I'm still new to Drupal and am not much of a Views expert at that, so I really don't know what else to do. Would appreciate any peice of advice on this.

Thanks so much!
Cecille

Comments

beautifulmind’s picture

Make sure that you override the setting for that particular view.
If you are using 'Defaults' it will affect all!

Regards.

Regards.
🪷 Beautifulmind

twenty2nd’s picture

The settings in my Page display uses the same settings in the Defaults. Almost always, I configure the Defaults settings first before adding displays.

Thanks for the tip though :)

Cecille

nevets’s picture

You should be able to make the following changes to the default view. I have not tried this but it may work.

I am guessing your view has an argument of type 'Node: nid', if not you will want to add one. Make the following settings

Set "Validator" to "Node"

Set "Types" to "Event" (the type of node you want the tab to show for)

Set "Action to take if argument does not validate" to "Hide view/Page not found".

twenty2nd’s picture

Thanks for the quick reply :)

My view type is User not Node. So I can't add a node id, unfortunately.

Other suggestions? Perhaps, I could set this Attendees tab in other ways but still using Views.

Best,
Cecille

cmav77’s picture

I used the suggestion above in a similar situation, and it worked very well (thanks, nevets!). Perhaps in your situation you can use the above configuration on your "(Attendance) Flags:Content ID" argument, as I believe that the Content ID is the Node ID in this case (essentially you have a relationship to the Node even though you have a User view type).

That is, for the Content ID argument:

Set "Validator" to "Node"

Set "Types" to "Event" (the type of node you want the tab to show for)

Set "Action to take if argument does not validate" to "Hide view/Page not found".

Hope that works!

Chris

twenty2nd’s picture

Thanks for clearing this up for me Chris! Really good yet simple explanation about Content IDs :)

Actually, the first time I did set the validator to Node, I couldn't make it work, apparently because I didn't set the action to "Hide view/Page not found".

Thanks for helping me figure this out! Thanks to nevets and beautifulmind too for the sound pieces of advice :)

Best of luck,
Cecille

antlib’s picture

I had the exact same problem and have spent the past hour scouring the whole Drupal.org site and leaving desperate follow-up messages to similar issues raised.

Thanks so much for your clear, concise instructions - you surely deserve a New Year's Drupal Honours medal if they ever existed.

Season's Greets!
Stan

webzucht’s picture

Got me going also...
(needed exact the same thing, but overlooked the "validator" in cases node-type is unavailable.
thanks

pnigro’s picture

twenty2nd,

Did you use views to add the tab Attendees to your content type Fields? If so, would you be able to describe how you did it? I am trying to do something similar except that the added tab is going to display images that are referenced to that particular node. Any help would be much appreciated. Thank you.

yuvraj_jain’s picture

tagging only

sbauch’s picture

I've achieved what I think was the problem here, only to create a new one. I also want certain menu tab views to show up only when accessing a certain type of node. I've gotten that to work using a Node:Type argument, and that takes care of the menu tabs themselves. But when the user clicks over to the tab none of my display fields are shown.

cezaryrk’s picture

I wrote a simple module "Views node access" for d7 which allows you to bind a view page to an specified node type. The code is in
http://drupal.org/sandbox/cezaryrk/1244456

meichr’s picture

The Views node access module is already a full project by Cezaryrk and can be found at http://drupal.org/project/views_node_access (the sandbox project mentioned above has been removed).