Teaser display only shows short review strings

pathfinderelite - January 15, 2009 - 15:25
Project:NodeReview
Version:5.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

When displaying a review node using the teaser view, the review string associated with each axis is only shown if the string is less than or equal to 50 characters. This happens because if a string is truncated (because it is more than 50 chars)..

// This code is found near line 340, nodereview_node_nodereview.inc
$row = array();
$row[] = $review->tag;
$row[] = $review->score/10 . '/10';
$review_text = truncate_utf8($review->review, 50, TRUE, TRUE);
$row[] = substr($review_text, 0, strpos($review_text, "\n"));
$rows[] = $row;

it no longer ends in a newline ("\n"). Thus, when finding the substring of $review_text from index 0 to the "\n", it returns nothing.

#1

pathfinderelite - January 15, 2009 - 15:31
Status:active» needs review

Here is a quick patch to fix this. Also note that truncating a string may also truncate any ending html tags.

AttachmentSize
nodereview-359305-1.patch 670 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.