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: [wish] I want my comments to be visible only for logged in
Pages: [1]   Go Down
  Print  
Author Topic: [wish] I want my comments to be visible only for logged in  (Read 1743 times)
0 Members and 1 Guest are viewing this topic.
eMCe71
Newbie
*

Karma: 0
Offline Offline

Gender: Male
Posts: 9



WWW Email
« on: December 20, 2010, 07:03:41 »

Hello,

I have been searching this forum but haven't found solution.

Is there a way or you could write such a feature that comments would be visible only for logged in people?
I have educational, medical site and I can't allow not logged/not verified people to read comments to articles.

Thanks a lot!
Mat
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: December 20, 2010, 16:41:09 »

You can change Content - JComments plugin's access level to Registered.
Logged

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

Karma: 0
Offline Offline

Gender: Male
Posts: 9



WWW Email
« Reply #2 on: December 20, 2010, 23:12:36 »

Thanks, but it's not what I wanted.

Solution which you described makes that unlogged people don't even see that there could be comments on website.

The best what I can imagine is that unlogged people see "Add comment (number of comments)" under the article and when they click on it they have article with information "You have to log in to see and write comments".

Is there a chance that you could provide such an opportunity? Smiley

I will be very thankfull  Wink
Mat
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #3 on: December 20, 2010, 23:58:36 »

In this case you could hide comments using comments template.

1. Open file /components/com_jcomments/tpl/default/tpl_tree.php (or tpl_list.php if you're using plain list layout)
2. Find line:
Code: (php)
$comments = $this->getVar('comments-items');
replace with
Code: (php)
$user =& JFactory::getUser();
if (!$user->id)  {
    $comments = null;
} else {
    $comments = $this->getVar('comments-items');
}

This code will hide comments list if current user isn't authorized.

Logged

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

Karma: 0
Offline Offline

Gender: Male
Posts: 9



WWW Email
« Reply #4 on: December 21, 2010, 01:55:00 »

I have just replaced it as you mentioned and unlogged people still can read comments. Look here: http://przypadkimedyczne.pl/z-pediatrii/3336-bezradni-lekarze.html
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #5 on: December 21, 2010, 02:03:39 »

What display layout are you use? Make sure that you've edited right file.
Logged

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

Karma: 0
Offline Offline

Gender: Male
Posts: 9



WWW Email
« Reply #6 on: December 21, 2010, 02:08:58 »

You are right and I am noob Smiley Thanks, works perfect!
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: [wish] I want my comments to be visible only for logged in
 
Jump to: