I'm not sure if the token_comment.inc file provides this in a way I just missed, however... The attached (one line) patch provides a token for a comment's cid. This is useful for providing direct links to a comment like: [node-url]#comment-[comment-cid]

Comments

greggles’s picture

Status: Active » Needs work

Thanks for the idea and the patch.

I believe this needs an entry in the comment_token_list function as well, right? That way people will know about it.

Otherwise this looks good to me.

ricflomag’s picture

Assigned: Unassigned » ricflomag
Status: Needs work » Needs review
StatusFileSize
new1.17 KB

I guess it should be considered a bug instead of a feature request: the helper text for 'comment-nid' says "Comment ID", which i suppose should return the cid property of the comment instead of the nid.

Anyway, here is a complete patch that corrects the helper text for 'comment-nid' and adds a 'comment-cid' token.

greggles’s picture

Category: feature » bug
Status: Needs review » Needs work

Looks like some weird whitepsace issues on the beginning of the $values['comment-cid'] = $comment->cid; line that come from tabs.

I believe that the \'s can cause problems for the internationalization extractor or for locale module or something like that.

So, t('Comment\'s node ID'); is better as t("Comment's node ID");

Can you re-roll? I agree, this is a bug given the misleading current token.

ricflomag’s picture

StatusFileSize
new1.17 KB

Done, thanks.

GoofyX’s picture

The patch that ricflomag provides in #4 should be committed, as instead of comment id, the latest stable (5.x-1.11) still returns the commented node's id instead of the cid.

Thanks.

greggles’s picture

Status: Needs work » Fixed

Agreed. Note to ricflomag - if you upload an updated patch please set it back to "patch (code needs review)" so it's more likely to catch my attention.

Thanks, jmiccolis, GoofyX, and ricflomag, for your work in providing and testing this patch. I've now fixed it in 6.x http://drupal.org/cvs?commit=127490 and 5.x http://drupal.org/cvs?commit=127489

Anonymous’s picture

Status: Fixed » Closed (fixed)

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