1

I'm using Organic groups (7.x-1.5) and wonder how to write a rule that would take the user from a group content page to the group page the content belongs to?

The event could be triggered by a button on the group content.

For example: I am viewing the page of the University of Berkeley and if I click on the button there, I am taken to the California universities page (University of Berkeley page is group content, California universities page is group.)

Notice I did not say "back" to the group since the user can land on the group content page without first landing on the group page.

Any suggestions?

2

Many approaches available here. You can use the rules link module to do this. It can fetch the parent node and redirect to it when the link is clicked. https://www.drupal.org/project/rules_link

However, check if organic groups provides tokens that you could use to build the link in html. Or a php snippet to grab the nid of the parent if it exists and print it as part of a link.

The other option is crumbs, the breadcrumbs module that automatically outputs the subgroup hierarchy. https://www.drupal.org/project/crumbs

If you are using panels, I'm pretty sure there's a replacement pattern for the parent if you create custom content.

| improve this answer | |
  • Tried Rules Link but it also requires the use of a rule. Prior to using this module, I couldn't write a simple redirect rule because many of the tokens provided by Organic Group do not work. So nothing changes. Will try crumbs. Thanks. – user14666 Mar 29 '16 at 20:12
  • Yes! The easiest solution was with panel. Thanks. :) – user14666 Mar 29 '16 at 20:38

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.