Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After having upgraded OG to 2.7, the token which contains the group reference does not work. I am using this in the patterns for URL aliases:
[node:og-group-ref:0:title]/[node:title]
With 2.6 I got e.g.:
covs.nl/redactie/test
In 2.7 this is only:
covs.nl//test
*Edit* I added an extra slash above, which I forgot. This emphasizes the missing token.
Comment | File | Size | Author |
---|---|---|---|
#17 | group_reference_token-2264759-17.patch | 562 bytes | paranojik |
#16 | group_reference_token-2264759-16.patch | 496 bytes | ultimike |
#15 | 2264759-group_reference_token-15.patch | 627 bytes | guillaumev |
Comments
Comment #1
shushu CreditAttribution: shushu commentedI tried this scenario:
1. Installed OG 2.6, created some content in group, and used Rules to print out the tokens you mentioned. I was able to see it properly.
2. Upgraded to 2.7, cleared cache, and tried to see the same tokens. I was able to see them properly.
If you have other scenario that can reproduce the problem, please let me know.
Comment #2
johnofjack CreditAttribution: johnofjack commentedWe're having the same results as the original poster: the existing token no longer works, but fails silently (getting a null result?)
I set up a fresh install of Panopoly and found that you get an error message when attempting to use a token calling on og-group-ref: The Pattern for all Blog entry paths is using the following invalid tokens: [node:og-group-ref:0].
Steps to reproduce:
1. Install Panopoly (pathauto will be installed with it).
2. Install Organic Groups 2.7.
3. Go to /admin/config/search/path/patterns and attempt to save the token [node:og-group-ref:0] as part of a URL alias pattern.
4. Get the previous error message.
Comment #3
shushu CreditAttribution: shushu commentedSorry, I failed to reproduce.
1. I installed panopoly.
2. I installed og.
3. (important) I configured OG fields for content types to make group and group content. Certainly, without it the token will be invalid.
4. I used [node:og-group-ref] on path pattern and on rules.
Please reopen if you have a valid scenario I can reproduce with.
Comment #4
miromarchi CreditAttribution: miromarchi commentedI have the same problem.
That's my scenario:
I have 3 node types. "Organization" → og group; "Project" → og group content; "relation" → og group content.
I'm using rules to create a node of type "relation" after a new node of type "project" is created.
So basically when an "organization" (group) creates a new "project", a "relation" is created between the two.
"Relation" content type has two fields of type entityreference, "source" - pointing to the organization; and "target" - to the project.
The rule states: After saving new content of type "project"; create new entity of type "relation"; set data value for this entity's field "source" equal to [node:og-group-ref:0] and field "target" equal to [node].
This was working before the last og update. Now the field "source" is left empty.
For quick verification I created a dummy rule saying: After visiting content of type "project"; print a message on the site with token [node:og-group-ref:0:title].
This is working fine.
Maybe this can help?
I also have seen recent updates in rules module. I've tried this scenario with or without the last rules update.
Comment #5
miromarchi CreditAttribution: miromarchi commentedReopen with a new scenario.
Comment #6
johnofjack CreditAttribution: johnofjack commentedSorry, I forgot to mention that I did create a group and make the "blog entry" content type group content.
The reason I'd reopened this with a followup was that this was working for us in OG 2.6 but after the update to 2.7 it was no longer working.
Does it matter that the fresh install I mentioned above was on Pantheon? (Is there some peculiarity of their implementation of the Panopoly distribution?)
Comment #7
miromarchi CreditAttribution: miromarchi commentedReferring to #4, me too, I'm using Panopoly distribution.
Comment #8
jpcondon CreditAttribution: jpcondon commentedI'm experiencing the same issue johnofjack is experiencing on a default drupal install. I was using OG 2.6 and I had URL aliases using the token [node:og-group-ref:0]. I upgraded to OG 2.7 and now I receive the same error stating it is an invalid token. I am presented with different options instead when I look at replacement patterns:
[node:og-group-ref] Field "og_group_ref".
[node:og-group-ref:1] The list item with delta 1. Delta values start from 0 and are incremented by one per list item.
[node:og-group-ref:2] The list item with delta 2. Delta values start from 0 and are incremented by one per list item.
[node:og-group-ref:3] The list item with delta 3. Delta values start from 0 and are incremented by one per list item.
None of these options and their respective tokens, for example [node:og-group-ref:1:title], work. When these options are used in the pattern it is ignored and removed from the alias on content creation/update. The default [node:og-group-ref] works fine, but since it appends each group to the alias it is important to have access to the delta values.
Comment #9
ultimikeI'm seeing this issue as well. The OG 7.x-2.7 update appears to have broken the [node:og-group-ref:1] tokens...
Then again, I upgraded Panopoly at the same time which brought Entity API from 7.x-1.3 to 7.x-1.5, so could this be an issue with Entity Token and not OG?
-mike
Comment #10
guillaumev CreditAttribution: guillaumev commentedSame issue here... I've noticed however that if you use a single-valued groups audience field, the token works...
Comment #11
edvanleeuwenThis has only to do with OG. Reverting back to 2.6 solves this.
Please bear in mind that 2.7 is a security update, so if you are going back to 2.6 this will be reintroduced.
Comment #12
edvanleeuwenComment #13
edvanleeuwenI did a fresh install with he following contributions:
Then I performed the following actions:
Shushu, if you need access to my test site, please let me know.
Comment #14
guillaumev CreditAttribution: guillaumev commentedAfter some analysis it appears that the commit that caused this issue is this one: http://cgit.drupalcode.org/og/commit/og.module?id=d187c93aec30bc0b7629f9.... Reverting it solves this issue...
Comment #15
guillaumev CreditAttribution: guillaumev commentedHere is a patch that fixes this temporarily, at least until both https://drupal.org/node/2220575 and this issue can be solved...
Comment #16
ultimikeWouldn't another way to fix this be to keep the call to og_get_entity_groups(), but reset the $gids array once it is returned?
Patch attached.
Thanks,
-mike
Comment #17
paranojik CreditAttribution: paranojik commentedUpdating title as this is a much broader issue. Anything that is relying on the 0 delta value of the group audience field will fail. This only occurs upon saving the entity.
IMHO @ultimike's solution is OK (field delta values should follow the number of actual values - og_get_entity_groups() returns values keyed by group_membership ID).
I'm just proposing a shorter version of @ultimike's patch...
Comment #18
edvanleeuwenTested and verified #17. Please merge with dev.
Comment #19
shushu CreditAttribution: shushu commentedThanks all for the details and the work.
Patch seems to work as expected, and solves the problem.
@paranojik, when submitting a patch it is better to leave it in "needs review" so someone else will review it.
Comment #20
amitaibuMerged, thanks.
Comment #22
miromarchi CreditAttribution: miromarchi commentedHi, thanks for the work. I've tested patch in #17 too, and I confirm it is solving the problem in my case. Thank you!
Comment #24
brad.bulger CreditAttribution: brad.bulger commentedcan anyone confirm, that, for instance, [node:og-group-ref:url:path] is wrong, and [node:og-group-ref:0:url:path] is correct? and that this is how it will continue to be? is it related at all to the cardinality of the og_group_ref field?
Comment #25
dureaghin CreditAttribution: dureaghin commentedIssue still persist, patch in #17 doesn't work for me.
Comment #26
Yorgg CreditAttribution: Yorgg commentedThe issue remains the same even though #17 has been merged.