Active
Project:
Simple Review
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Nov 2008 at 15:02 UTC
Updated:
3 Nov 2008 at 15:02 UTC
Hi,
This is an excellent module, but it would be even better if it replaced where it says "1 comment" to "1 review" or where it says "x comments" to "x reviews". I think it only makes sense for a module like this to do that since if the initial link says "review this article" and then when review is posted it actually says "1 comment", it doesn't quite fit.
I tried doing this myself, but I'm not well versed with PHP and I failed. I tried to add this to the simple_review_link_alter function:
if (isset($links['comment_comments'])) {
$links['comment_comments']['title'] = t('1 review', '@count reviews');
$links['comment_comments']['attributes'] = t('Jump to the first review of this posting.');
}
if (isset($links['comment_new_comments'])) {
$links['comment_new_comments']['title'] = t('1 new review', '@count new reviews');
$links['comment_new_comments']['attributes'] = t('Jump to the first new review of this posting.');
}
So it looked like this:
function simple_review_link_alter($node, &$links) {
if (variable_get('simple_review_'. $node->type, 0)) {
if (isset($links['comment_add'])) {
if (!simple_review_already_reviewed($node->nid)) {
// Change wording
$links['comment_add']['title'] = t('Review this movie');
$links['comment_add']['attributes']['title'] = t('Share your thoughts and opinions and rate this movie.');
}
else {
// Remove link when already reviewed
unset($links['comment_add']);
}
}
if (isset($links['comment_comments'])) {
$links['comment_comments']['title'] = t('1 review', '@count reviews');
$links['comment_comments']['attributes'] = t('Jump to the first review of this posting.');
}
if (isset($links['comment_new_comments'])) {
$links['comment_new_comments']['title'] = t('1 new review', '@count new reviews');
$links['comment_new_comments']['attributes'] = t('Jump to the first new review of this posting.');
}
}
}
But that does not work.
If you could at least tell me what I'm doing wrong that'd be great. I was mostly following what was done with comment_add and tried to copy that.
Thanks