Hey,

as we talked about this on IRC, [[http://drupal.org/project/comment_edited|comment edited]] now has an option to display the "edited by ... message" outside the comment body. For this the templates needs to use $comment->comment_edited property. It passes the themed edit messages (with the new 1.3 version moderator edits are separated out, thus the plural). The module provides the theme_comment_edited_messages() theme function, override this if you want to change the way these messages are rendered.

More information in this issue: #400424: Option to put "edited by" string below comment body.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Michelle’s picture

Status: Active » Postponed

Thanks, snufkin. All 2.x issues are getting postponed for the moment until I get a 2.x branch opened up to refile them all.

Michelle

Michelle’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Postponed » Active
Michelle’s picture

Status: Active » Fixed

I added the following code. I haven't actually tested to see if it works because I don't use comment edited (switched to nodecomment after this issue and it doesn't support nodecomment that I'm aware of). If this variable has changed, please let me know so I can fix it.

      <?php if (!empty($comment->comment_edited)): ?>
        <div class="comment-edited">
          <?php print $comment->comment_edited ?>
        </div>
      <?php endif; ?>

Michelle

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

aharown07’s picture

Status: Closed (fixed) » Needs work

It doesn't work. I use comment edited module with 6x2x alpha3 ... comment edited lines do appear but their location cannot currently be managed from post.tpl.php
They are wrapped in a different class than the "comment_edited" one that appears in the code above.

Going to see if I can figure out some more info since I kind of want to move the edited line down below the signature.

Michelle’s picture

Project: Advanced Forum » Comment edited
Version: 6.x-2.x-dev » 6.x-1.x-dev

Ok... Bopping this over to the CE queue to find out what the variable has changed to.

Michelle

aharown07’s picture

Project: Comment edited » Advanced Forum
Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Needs work » Closed (fixed)

OK, turns out you just have to enable the " Use a template variable" in the Comment Edited settings. Then it works.

Michelle’s picture

Ok, thanks for letting me know.

Michelle

aharown07’s picture

Michelle’s picture

Status: Closed (fixed) » Active

I don't use the module... Someone needs to tell me what he changed the variable to.

Michelle

snufkin’s picture

If there is a breakage it wasnt intentional, I'll look into it. I was a bit focused to get the SA fix out, sorry.

Michelle’s picture

Category: feature » task

Fixing category. I'm filtering out FRs right now and don't wan to lose track of this.

Michelle

aharown07’s picture

Rolling back Commented Edited to the previous release works fine in AF 2 Alpha3. I don't have opp. to test right now in the Dev version. Fairly confident there is no AF issue here. Just posted here for the benefit of anyone having the problem who lands here on their search.

Michelle’s picture

Status: Active » Postponed (maintainer needs more info)

Well, if the variable in the template changed, that needs to be changed in AF as well. Going to set this NMI since there's nothing more I can do at this point. Please set it active if/when there is something in AF I can do.

Thanks,

Michelle

Michelle’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Cleaning up the queue. If there's something AF can do here, feel free to re-activate.

Michelle

snufkin’s picture

Status: Closed (won't fix) » Active

I am wondering how to resolve this elegantly so that it works with AF. the bit of code in the older version that worked was:

In hook_comment op view:

     // Depending on configuration append to the comment body, or add $comment->comment_edited
     $comment_edited = theme('comment_edited_messages', $messages);
     $use_template = variable_get('comment_edited_use_template', 0);
     if ($use_template) { // if we use template, then dont theme it
       $comment->comment_edited = $comment_edited;
     }
     else { // themed message appended
       $comment->comment .= $comment_edited;
}

which changed to (still in hook_comment op view)

    if (!variable_get('comment_edited_use_template', 0)) {
      $messages = comment_edited_get_display_messages($comment);
      $comment->comment .= theme('comment_edited_messages', $messages);
    }

and i added a new preprocess:

function comment_edited_preprocess_comment(&$variables) {
  if (variable_get('comment_edited_use_template', 0)) {
    $messages = comment_edited_get_display_messages($variables['comment']);
    // Depending on configuration append to the comment body, or add $comment->comment_edited
    $variables['comment']->comment_edited = theme('comment_edited_messages', $messages);
  }
}

should i undo the preprocess function perhaps?

aharown07’s picture

Whatever works is OK by me :)
Anybody tested this lately? I haven't moved to the latest AF alpha yet.

Michelle’s picture

Sorry, I've been really busy and then really sick and haven't looked at this, yet.

Michelle

aharown07’s picture

No big rush on my account. :) It'll be a while before I'm ready to test anyway.

Michelle’s picture

Status: Active » Needs review

Setting anything with code to "needs review" but a proper patch would be helpful if you're still interested.

mcdruid’s picture

Status: Needs review » Fixed
FileSize
587 bytes

I'm not entirely sure what changed where to break this, but I got it working (with comment_edited 6.x-1.4) by making the small change in the attached patch.

I had to hack comment_edited module to get it to actually record anything in the comment_edited_data table, and therefore actually put anything in $comment->comment_edited but perhaps that's just because I don't understand how it's supposed to work.

Anyway, with this patch applied to AF, I get comment edited messages showing up as expected.

I'm going to commit this to 6.x-2.x branch now, but it would be great if someone who actually uses this combination of modules could confirm that the patch fixes the issue for them - aharown07?

aharown07’s picture

Will have to get back to you on that.
I'm using comment edited w/o any problems now but can't remember what I did to make that happen. My live site is AF 6x2 alpha 3. Comment Edited I'm using is ver. 6x1.3

Have a test site w/Alpha 4.

aharown07’s picture

Title: Support for commend edited message in the template » Support for comment edited message in the template
Status: Fixed » Needs review

I am not able to verify that this works. Quite likely I'm doing something incorrectly.
I applied the patch manually to my Adv Forum alpha4 and upgraded Comment Edited to 6x 1.4
Comment edited lines were not displaying in my "Naked" theme.
Took a look at advanced_forum.naked.post.tpl.php and found that it was using a $post_edited variable rather than $comment_edited. Made changes there but still not seeing any comment edited lines.
Have I got the wrong template maybe?

mcdruid’s picture

Thanks for testing aharown07.

The template should be using $post_edited, as that's the name of the variable where AF's preprocess function puts the output of the comment_edited module:

$variables['post_edited'] = (isset($comment->comment_edited)) ? $comment->comment_edited : "";

Would you be able to test with the latest dev release of AF please? as this is where I made the changes.

aharown07’s picture

Giving the dev release a go. Should have results shortly.

Update: using Comment Edited 6x-1.4 and Advanced Forum 6.x-2.0-alpha4+38-dev, the edited-by info is not displaying when I edit comments either as user1 or as another user.

Not sure why yet. I'll check my Com Ed settings etc. for anything obvious then look at templates I suppose... maybe something in my theme is interfering?

(Tried both with and without the "use template variable" option enabled in Comment Edited... and with both Naked and Blue Lagoon themes... still no comment edited info apearing)

aharown07’s picture

Correction.
Old Comment Edited lines are displaying. For some reason, new ones are not. Given how AF's part of it appears to work, the problem must be in Comment Edited somewhere... it's not loading anything into the variable for AF to display.

Update: tested with Comment Edited 6x-1.3 - works fine.
It appears that 6x-1.4 is broken.

mcdruid’s picture

Status: Needs review » Fixed

Update: tested with Comment Edited 6x-1.3 - works fine.
It appears that 6x-1.4 is broken.

...which might explain why:

I had to hack comment_edited module to get it to actually record anything in the comment_edited_data table, and therefore actually put anything in $comment->comment_edited but perhaps that's just because I don't understand how it's supposed to work.

I'm going to mark this as fixed for now, as it seems we've done what we needed to in AF.

mcdruid’s picture

I was curious about this, so I checked what I had to hack to get comment_edited working.

It was this line in comment_edited.module (in the 6.x-1.4 release):

  case 'update':
    global $user;
    $previous = _comment_load($comment['cid']);
    // User 1 automatically does silent edit.
    // Do not log comment change where its just being unpublished.
    if ($previous->status != $comment['status'] && $user->uid != 1) { // User 1 does silent edits.
      $data = new StdClass;
      // $comment is the comment form
      $data->cid = $comment['cid'];

...which I changed to:

    if ($previous->status == $comment['status'] && $user->uid != 1) { // User 1 does silent edits.

If you check the dev release of comment_edited, this change is in there too. So it does indeed look like 6.x-1.4 is at least somewhat broken.

Perhaps try the dev version, or ask snufkin very nicely to make a new release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.