Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: show comments author in search results
Pages: [1]   Go Down
  Print  
Author Topic: show comments author in search results  (Read 8080 times)
0 Members and 1 Guest are viewing this topic.
agez
Newbie
*

Karma: -5
Offline Offline

Gender: Male
Posts: 7



« on: October 02, 2010, 20:17:52 »

Hi there again Smiley

I was wondering maybe someone can help me figure out how to show comments author in search result? That's it
thank you Smiley
Logged
smart
Administrator
Hero Member
*****

Karma: 187
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #1 on: October 03, 2010, 02:49:02 »

But Joomla doesn't shows article's author in search results too.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
agez
Newbie
*

Karma: -5
Offline Offline

Gender: Male
Posts: 7



« Reply #2 on: October 03, 2010, 03:49:11 »

so this isn't possible to show author in search result or it's just too complex? Smiley
Logged
smart
Administrator
Hero Member
*****

Karma: 187
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #3 on: October 03, 2010, 04:02:40 »

As Joomla doesn't show such information where is no placement for it in search results. But if you strongly needed to add author's name in search result you could insert it before comment's text.

Open file /plugins/search/jcomments.php and replace:

Code: (php)
. "\n  comment AS text"
with:
Code: (php)
. "\n  comment AS text"
. "\n,  userid"
. "\n,  name"
. "\n,  username"

And replace:
Code: (php)
$rows[$i]->text = $comment;
with
Code: (php)
$rows[$i]->text = JComments::getCommentAuthorName($rows[$i]) . ' wrote:' . $comment;
« Last Edit: October 03, 2010, 05:32:01 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
agez
Newbie
*

Karma: -5
Offline Offline

Gender: Male
Posts: 7



« Reply #4 on: October 03, 2010, 05:21:03 »

thank you very much Smiley
« Last Edit: October 03, 2010, 05:23:42 by agez » Logged
smart
Administrator
Hero Member
*****

Karma: 187
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #5 on: October 03, 2010, 05:32:26 »

All works now?
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
agez
Newbie
*

Karma: -5
Offline Offline

Gender: Male
Posts: 7



« Reply #6 on: October 03, 2010, 05:41:54 »

Yes but i'm strugling to make author name in bold Sad

Code:
$rows[$i]->text = '<b>' .JComments::getCommentAuthorName($rows[$i]) . ' wrote:' . '</b>' . $comment;

it isnt working ;(
Logged
smart
Administrator
Hero Member
*****

Karma: 187
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #7 on: October 04, 2010, 15:02:38 »

Yes but i'm strugling to make author name in bold Sad
You couldn't use HTML tags because Joomla strips them in search result output. If you need <b> tag you need to open file /administrator/components/com_search/helpers/search.php and replace:

Code: (php)
return SearchHelper::_smartSubstr( strip_tags( $text ), $length, $searchword );
with
Code: (php)
return SearchHelper::_smartSubstr( strip_tags( $text, '<b>' ), $length, $searchword );
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: show comments author in search results
 
Jump to: