1

I am trying to create a simpler version of Organic Groups as I don't need most of it's functionality. What I am trying to do is use entity reference, nodeaccess_userreference and nodeaccess_nodereference to duplicate the bulk of what OG does.

At the moment I am trying to create the view to show all content types content that is linked to a "group" content type.

Content types:

Group

Link

Text Post

(basically reddit.com!)

Fields:

field_group - entityreference to group content type attached to link and text post.

field_shortname - textfield with a shorter name for group (no spaces, alphanumerical, etc..)

Views:

Format: Unformatted List

Page: /g/% <---so I can use group name or shortened name to access group page

Relationships:

Entity Reference: Referenced Entity to field_group (required)

Contextual Filters:

Content: Title

Content: Field_shortname

Content: NID

(all requiring relationships to Entity Reference)

This way if some one goes to /g/Long-Group-Name-Blah-Blah /g/Shortername or /g/3 they will all point to the correct group page and show the link and text post content type content.

I can sort of get it to work if I just use Content: NID as the contextual filter. But I would like to be able to use the group name or shorter version in the URL as well. It also stops working as soon as I add 2 contextual filters.

Any help on getting this to work.

Thanks

  • As far as I understand, You would like to show a block in a Group node with all Links and Text Post nodes that have the Group node ID in their entity reference field. Is it right? – Vincenzo Gambino Nov 18 '14 at 10:38
0

Contextual filters work combined (AND), so if you define two or more contextual filters, all of them have to pass.

Here's what I would do.

  1. Use Pathauto to create a pattern for your group content, e.g. g/[node:nid].
  2. Create additional aliases for long name and short name.
  3. Make your view work with just the NID contextual filter and use the block display type.
  4. Configure your block to only show up on group node type and place it in main content.

Alternatively, you can also use Panels to create a similar node page for group nodes. To create the additional URL aliases for each group, you might want to try NodeSymLinks module.

  • Thank you for the response. I was under the impression that contextual filters worked off the OR operator. So that makes more sense. I will try that out and see if I can get it to work. Seems like a better way to handle it – Brandon Nov 20 '14 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.