when a comment is being added on a page that is not part of its parent entity there is no function for looking up the og of the parent comment and modules like notifications_team can not retrieve that info.
the menu structure, comment/reply/1/1 requires a contextual hook.
This issue has come up in response to #1861400: Limit List of Users Based on Organic Groups Context.
I made an extension module http://drupal.org/project/og_context_comment here. In the issue #1868288: Provide as patch for OG core, Amitaibu asked me to patch og_context core and provide it so this is a place holder for my patch.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1876740-og-context-comment-8.patch | 1.61 KB | amitaibu |
#7 | comment_handler-1876740-7.patch | 1.69 KB | sanguis |
#3 | comment_handler-1876740-3.patch | 1.57 KB | sanguis |
#1 | comment_handler-1876740-2.patch | 2.01 KB | sanguis |
Comments
Comment #1
sanguis CreditAttribution: sanguis commentedpatch file here.
Comment #2
amitaibuadd_comment => comment
parent entity => parent content
Better use menu_get_object() and/ or menu_get_item()
This part is copied from og_context_handler_node() -- better split it, so we don't duplicate code.
Comment #3
sanguis CreditAttribution: sanguis commentedokay done, thanks for the guidance.
Comment #4
sanguis CreditAttribution: sanguis commentedComment #5
amitaibuA little more polish :)
Callback should be og_context_handler_comment
Missing PHPdocs.
instead of is_null, you can use empty($node) -- that's how it's usually done in core.
menu_get_object() (without 'node') is enough.
$move the end(..) part to own variable ($cid).
This can be in one line
return !empty($comment->nid) ? .. : ...;
Comment #6
sanguis CreditAttribution: sanguis commentedthis is from the original function:
Are you sure that this should be modified?
Comment #7
sanguis CreditAttribution: sanguis commentedregardless here is the new patch.
Comment #8
amitaibuCleaned up code.
Comment #9
amitaibuCommitted.