It would be useful to have an Entity API metadata property that returns the OG roles for a membership entity.
This would be analogous to the 'roles' property that Entity API provides on users. However, in the OG case the only entity where it makes sense to place the property is the OG membership, as that has a connection to both the user and the group. If you have just a user, you can't tell the metadata wrapper which group you are interested in.
OG membership entities also represent relationships between a group and its actual content (such as nodes): in this case, this roles property would return an empty array.
Patch coming!
Comment | File | Size | Author |
---|---|---|---|
#1 | 2127033.og_.og-roles-metadata-property.patch | 1.95 KB | joachim |
Comments
Comment #1
joachim CreditAttribution: joachim commentedComment #2
amitaibuComment #3
amitaibuWhat's the use case of using it. Why not just call og_get_user_roles() directly -- Is it for Rules?
Comment #4
joachim CreditAttribution: joachim commentedIt's actually for a reports & statistics system I am building, where it make life a lot easier if I access every piece of data about entities via the metadata wrapper.
But I suppose you could also use it for Rules.
Comment #5
phenaproxima+1 on this. I really need role information exposed to Rules. Besides, is there any good reason to NOT expose this information to Entity API? @joachim's patch works for me!