I try to use [node:og_group_ref], but that gives me the group node title and I need the GID, I am sure there should be a way to get it but I haven't found it
3 Answers
In Organic Groups 7.2 the Node idea and Group id are the same. So if you are using views you can do the following:
Add field "Content: Nid" and exclude if from display. Any field arranged below the above can use [nid] as a rewrite giving you the Group ID.
Does this help?
-
Since the question seems to imply the group ID is stored in
og_group_ref
, I believe the author is looking for ID of the group(s) of which the current node is a member. Taking the node ID does not solve it, then.– taniusCommented Mar 15, 2016 at 19:24
You can make the [node:og_group_ref]
token output the numerical ID instead of the group name by setting up the "Token" display mode for your content type and choosing the "Entity id" formatter for that field:
As shown in this comment in the issue queue:
- Go to "Structure → Content Types → [your content type] → Manage Display".
- Click "Custom Display Settings" below the field list, enable the "Token" option and save.
- Go to the new "Token" display mode in the horizontal tabs on the top.
- For your
og_group_ref
field, set "Format: Entity id" and save.