function comment_og_preprocess_comment() modifies the comment links regardless of whether or not the node being commented on is posted into a group. I don't think that's what is intended.
To keep from opening a separate issue, there are a couple of coding convention issues in the same function (you can see what they are by running the module through Coder).
I haven't tested the following code, but it seems like it would make more sense in the context of what this module is trying to do:
<?php
function comment_og_preprocess_comment(&$variables) {
$group = og_get_group_context();
// if group context
if ($group) {
$comment = $variables['comment'];
// load links for current comment
$links = comment_links($comment, FALSE);
// remove the reply link for non-group members
if (!og_is_group_member($group)) unset($links['comment_reply']);
// we add the Group ID to the URL to determin group admin status later
if (og_is_group_admin($group)) {
$links['comment_delete'] = array(
'title' => t('delete'),
'href' => "comment/delete/$comment->cid/$group->nid"
);
}
// reset the links HTML
$variables['links'] = theme('links', $links);
}
}
?>
Note also that there's a trailing ?> in comment_og.module that is unnecessary -- see http://drupal.org/coding-standards#phptags for reasoning.
Comments
Comment #1
perkeSame here, users trying to add comments on nodes that are not posted in the groups are unable to. There is also message "You must be a member of this group in order to post a comment".
Will try the above code in the morning.
Comment #2
superoperater commentedThere's a group context missing in comment_og_form_alter, so when it's added, comment_og module won't affect all content types, but only those related to groups.
Comment #3
perkeworks for me! thanks superoperater!
Comment #4
Babalu commentedthx, works
Comment #5
bmblack commentedthis works for me ... kind of. This fix allows me to make comments now, but it's very hard to get to the comment section.
My blogs and other content still do NOT display an "Add New Comment" link unless I'm logged in as ADMIN.
If you know the url to the comment page (ex: mysite.com/comment/reply/446#comment-form) you can access the page and leave a comment, but I would like the "add new comment" button to display at the bottom of blogs for users other than Admin.
Any suggestions?
UPDATE:
Also worth noting ... the "Add new comment" link DOES show up for groups. When I manually enter the link to the comment page (ex: mysite.com/comment/reply/446#comment-form) and post a comment, the reply button also shows up fine.
It looks like my only issue is that the "Add new comment" link doesn't show up on any of my blog entries unless logged in as admin.
UPDATE 2:
I have confirmed that the issue is with this module. I disabled the Comment OG module for now and the add new comment button came back and works fine on my blog entries. I would like to be able to use this module to regulate posting in my organic groups, so any help would be much appreciated. :)
Comment #6
AntiNSA commentedsubscribing.... Is this module working yet?
Comment #7
perkeit does work, try it out before you change priority of issue ;)
Comment #8
chromix commentedThanks guys. These changes are now in dev. I'll create a new release once I get feedback on another change I made.