Closed (outdated)
Project:
Organic Groups
Version:
7.x-2.x-dev
Component:
og.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2012 at 15:43 UTC
Updated:
8 Dec 2025 at 00:41 UTC
Jump to comment: Most recent
Comments
Comment #1
amitaibuHi g089h515r806!
Yes, the table is kept empty, as don't use the field storage (just the widget/ formatter). Instead we create an OG-membership entity. You can have a look at the provided default views, to see how to use OG membership in a view (i.e. as relationship).
Comment #2
g089h515r806 commentedDo not compatiable with pathauto module.
I use pathauto module, and set the path alias to:
company/[node:og_group_ref]/job/[node:nid]
I could not get [node:og_group_ref] in the alias path of a job.
Comment #3
g089h515r806 commentedI try it with [node:og_group_ref:nid], I get a error,
Then i try it with [node:og-group-ref:nid], It still not works correctly.
Maybe we could save a copy of the data to field_data_og_group_ref table, then it will works much better with views and pathauto.
Comment #4
amitaibuViews works ok with the OG membership relationship, and we don't want to duplicate our data.
Regarding pathauto, it should be working, as in hook_load() we populate the field values on the fly.
Comment #5
g089h515r806 commentedthe result alias is "company/job/32"
My expectation is "company/22/job/32"
It does not work as my expectation.
This is my requirement:
company/22
company/22/job/32
company/22/discussion/35
company/22/event/41
company is a group which represent a company. job,discussion,event are group content type.
I think the reason is, when pathauto generate the value of "[node:og_group_ref]", it does not called hook_load() .
I am not sure.
It is very similar with that i could not use og_group_ref as contextually filter of views.
Comment #6
g089h515r806 commentedI have not test it with regular entity reference field, maybe it is a bug of entity reference.
Comment #7
dtarc commentedI'm trying to get this to work with EntityFieldQuery but can't set fieldCondition()s on og_group_refs.
Is there a way to use EntityFieldQuery with OG 7.x-2.x?
Comment #8
dtarc commentedI discovered that it was very easy to use EntityFieldQuery to get group posts:
Thanks for making it easy. I'm getting much more stoked about OG7 after using the 2.x branch a bit.
Comment #9
aasarava commentedAmitai, I'm having the same problem as g089 reports with the tokens, in particular [node:og-group-ref:nid]. It works fine when using regular entity reference. When using groups reference, the token is not populated.
Comment #10
amitaibu@aasarava, did you try with latest -dev?
Comment #11
aasarava commentedYes, with:
og: 7.x-2.0-alpha2+48-dev
entityreference: 7.x-1.0-rc1
Comment #12
amitaibuI've committed a fix, that should properly populate the group-audience field values, so pathauto should work.
og_field_attach_insert/ update() are now making sure the entity has the field values updated.
Comment #13
aasarava commentedThank you! I have tested it and it seems to work.
Comment #15
Sinan Erdem commentedI am using the latest version of og (2.x-dev, 2012-May-01). I use this form in pathauto pattern settings:
group/[node:og_group_ref]/[node:title]
but, instead of printing this as alias:
group/my_group/post_title
it only prints:
group/post-title
Comment #16
brightboldSame problem here with rc3. I want the following pattern:
group/group ID/group content type/node IDbut I can't find the token for the group ID. It seems like
[node:og-node1:nid]should work (this site is upgraded from 7.1, so instead of og_group_ref I have a different field for each content type; og-node1, og-node2, etc.) but Pathauto throws an "invalid token" error.I think I could use
[site:og-context-node]for newly created content, but this doesn't work for updating URLs with VBO, which I need to do. Any ideas?Comment #17
brightboldUpdate:
[site:og-context-node:nid]works (the token I suggested above gives you the group title, not the ID), but of course not through VBO.Comment #18
lahode commentedHi,
I'm using OG for 40 different sites having 20'000 users in common. And with all that I must manage the userrights hierarchically for around 1000 departements. OG seems perfect to fit that need, however........
I created a shared database where I put the user table, profile2, an custom entity used for the OG group "departement", but as OG is not only used for the "department rights", I cannot put og_membership table into my shared database.
I thought I could just create a field in OG UI (/admin/config/group/fields) and assign it to my entity and then transfer the "field_data_xxx" table in my shared database, but the way everything is done (all infos into the same og_membership table) makes things complicate.
Have you a solution? Is there no way not to use og_membership but an entity_ref field or indicating somewhere that if the group_type is "departement", then OG should seek the information in "og_membership_departement" table?
Comment #19
g089h515r806 commentedTest again with:
group/[node:og-group-ref:1:nid]/post/[node:nid]
it still does not work, [node:og-group-ref:1:nid] is empty.
Comment #20
g089h515r806 commentedtry it with [site:og-context--node:nid] after i enable Organic groups context, it still soes not work.
Comment #21
g089h515r806 commented[site:og-context--node:nid] does not work on pathauto's bulk update. it works on goup post's edit page.
[node:og-group-ref:1:nid] does not work on both case.
Comment #22
a.milkovskyComment #1 describes why the table is empty. It makes sense in most of cases.
But in this case the revision functionality is dropped.
When the field functionality is not used it's not possible to use revisions of the og_group_ref field.
For example:
When the entity with og_group_ref field needs moderation for change, it's not possible to change OG at all.
Comment #23
tyler.frankenstein commentedThank you @a.milkovsky for pointing out the non-existant revision data for og_group_ref data. After all these years I'm surprised I never noticed this data isn't traditional field data with revision records.
Here's a way to hold onto the original og_group_ref value so that it is available later on for comparison:
Normally one should be able to programmatically access the
$node->originalvalues, but in case you're using a background process or shutdown function, you can grab the value from original and set it aside on the$nodeobject for later, because the original value will get lost.Later, access the value using
$node->example_og_group_ref['presave_target_id']Comment #25
joelpittetDrupal 7 reached end-of-life and the D7 version of Organic Groups is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues. If you still have questions about using Organic Groups on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #og channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome! 💙