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

Login with username, password and session length

JoomlaTune Support Forum    JComments component    General discussion    Topic: Comments visible only to registered
Pages: [1]   Go Down
  Print  
Author Topic: Comments visible only to registered  (Read 3715 times)
0 Members and 1 Guest are viewing this topic.
Lumino
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« on: April 11, 2012, 21:38:33 »

Hello!

My problem in Joomla 1.5:

1 - to show the articles to all users.
2 - to write and read the comments only to registered users.

Solutions?
« Last Edit: April 12, 2012, 01:07:51 by Lumino » Logged
tbritton
Newbie
*

Karma: 0
Offline Offline

Posts: 9


« Reply #1 on: April 16, 2012, 09:00:28 »

With the current version of JComments and Joomla 2.5 you can configure what you desire in the backend permissions.  I'm not familiar with running JComments on 1.5 but you could wrap the div with class jc in tpl_index.php as follows.

Code:
<?php
$user 
=& JFactory::getUser();
if(
$user->id)
?>

   <div id="jc"> // existing code
    ...  // exiting code
   </div>  // existing code
<?php } else {
    echo 
"You must be registered to view comments.";
?>

Add the first part above div id="jc" in the file and the last part after the closing div.
Logged
Lumino
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #2 on: April 23, 2012, 14:36:40 »

It does not work. Maybe I was wrong to enter the code.
Also I can not see the link to add comments.
You can modify the original code?

Code:
<?php

(defined('_VALID_MOS') OR defined('_JEXEC')) or die;

/*
*
* Main template for JComments. Don't change it without serious reasons ;)
* Then creating new template you can copy this file to new template's dir without changes
*
*/
class jtt_tpl_index extends JoomlaTuneTemplate
{
function render() 
{
$object_id $this->getVar('comment-object_id');
$object_group $this->getVar('comment-object_group');

// comments data is prepared in tpl_list and tpl_comments templates 
$comments $this->getVar('comments-list''');

// form data is prepared in tpl_form template.
$form $this->getVar('comments-form');

if ($comments != '' || $form != '' || $this->getVar('comments-anticache')) {
// include comments css (only if we are in administor's panel)
if ($this->getVar('comments-css'0) == 1) {
include_once (JCOMMENTS_HELPERS.DS.'system.php');
?>

<link href="<?php echo JCommentsSystemPluginHelper::getCSS(); ?>" rel="stylesheet" type="text/css" />
<?php
if ($this->getVar('direction') == 'rtl') {
$rtlCSS JCommentsSystemPluginHelper::getCSS(true);
if ($rtlCSS != '') {
?>

<link href="<?php echo $rtlCSS?>" rel="stylesheet" type="text/css" />
<?php
}
}
}

// include JComments JavaScript initialization
?>

<script type="text/javascript">
<!--
var jcomments=new JComments(<?php echo $object_id;?>, '<?php echo $object_group?>','<?php echo $this->getVar('ajaxurl'); ?>');
jcomments.setList('comments-list');
//-->
</script>
<?php
// IMPORTANT: Do not rename this div's id! Some JavaScript functions references to it!
?>

<div id="jc">
<?php
if ($this->getVar('comments-form-position'0) == 1) {
// Display comments form (or link to show form)
if (isset($form)) {
echo $form;
}
}
?>

<div id="comments"><?php echo $comments?></div>
<?php
if ($this->getVar('comments-form-position'0) == 0) {
// Display comments form (or link to show form)
if (isset($form)) {
echo $form;
}
}
?>

<div id="comments-footer" align="center"><?php echo $this->getVar('support'); ?></div>
<?php
// Some magic like dynamic comments list loader (anticache) and auto go to anchor script
$aca = (int) ($this->getVar('comments-gotocomment') == 1);
$acp = (int) ($this->getVar('comments-anticache') == 1);
$acf = (int) (($this->getVar('comments-form-link') == 1) && ($this->getVar('comments-form-locked'0) == 0));

if ($aca || $acp || $acf) {
?>

<script type="text/javascript">
<!--
jcomments.setAntiCache(<?php echo $aca;?>,<?php echo $acp;?>,<?php echo $acf;?>);
//-->
</script>
<?php
}
?>

</div>
<?php
}
}
}
?>
« Last Edit: April 23, 2012, 14:38:34 by Lumino » Logged
tbritton
Newbie
*

Karma: 0
Offline Offline

Posts: 9


« Reply #3 on: April 24, 2012, 04:15:28 »

I can't copy your code without it all showing up on one line, so I'll describe it specifically for the posting you made.  Insert the following code right after line 51 and before <div id="jc">.

Code:
<?php$user =& JFactory::getUser();
if(
$user->id)
?>

Add the following code after line 87 and before <?php.  This is line 87 before the addition of the above code.

Code:
<?php } else {    echo "You must be registered to view comments.";} ?>

I do not have access to a 1.5 machine to test this, but it should work.
Logged
Lumino
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #4 on: April 28, 2012, 20:02:55 »

Nothing. It does not work.
Thanks tbritton.
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #5 on: May 30, 2012, 14:40:01 »

Set 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
Lumino
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #6 on: May 31, 2012, 20:56:41 »

Set Content - JComments plugin's access level to 'Registered'.

With that setting items are not visible to unregistered.
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #7 on: June 01, 2012, 13:33:42 »

1 - to show the articles to all users.
2 - to write and read the comments only to registered users.
and:
With that setting items are not visible to unregistered.

Seems all correct. Articles are visible for everyone, only registered are allowed to read and write comments.
Logged

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

Karma: 0
Offline Offline

Posts: 5


Email
« Reply #8 on: June 01, 2012, 18:30:10 »

1 - to show the articles to all users.
2 - to write and read the comments only to registered users.
and:
With that setting items are not visible to unregistered.

Seems all correct. Articles are visible for everyone, only registered are allowed to read and write comments.

No.
Click here: http://www.federossoblu.com/it/articoli/primo-piano/1672-comunicato-curva-andrea-costa-pro-terremotati.html

whit Content - JComments plugin's access level to 'Registered'

I leave it for a short time
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: Comments visible only to registered
 
Jump to: