How to use rules to take a user from a group content page to the group page the content belongs to?

drupal.stackexchange https://drupal.stackexchange.com/questions/196098

  •  01-10-2020
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top