1
jakob
Comments only viewable for members?
  • 2004/10/6 15:47

  • jakob

  • Just popping in

  • Posts: 14

  • Since: 2002/10/18


Hi,

I'm running a website using XOOPS 2.0.5. Is it possible to only let logged in users view news comments?

Anonymous users should still be able to read the news.

TIA,

Jakob

2
ackbarr
Re: Comments only viewable for members?

you can accomplish this with a slight smarty template change:

in the template news_article.html:
change:
<div style="text-align: center; padding: 3px;
margin:3px;"
>
<{
$commentsnav}>
<{
$lang_notice}>
</
div>

<
div style="margin:3px; padding: 3px;">
<!-- 
start comments loop -->
<{if 
$comment_mode == "flat"}>
<{include 
file="db:system_comments_flat.html"}>
<{elseif 
$comment_mode == "thread"}>
<{include 
file="db:system_comments_thread.html"}>
<{elseif 
$comment_mode == "nest"}>
<{include 
file="db:system_comments_nest.html"}>
<{/if}>
<!-- 
end comments loop -->
</
div>

to:
[b]<{if $xoops_isuser eq 1}>[/b]
<
div style="text-align: center; padding: 3px;
margin:3px;"
>
<{
$commentsnav}>
<{
$lang_notice}>
</
div>

<
div style="margin:3px; padding: 3px;">
<!-- 
start comments loop -->
<{if 
$comment_mode == "flat"}>
<{include 
file="db:system_comments_flat.html"}>
<{elseif 
$comment_mode == "thread"}>
<{include 
file="db:system_comments_thread.html"}>
<{elseif 
$comment_mode == "nest"}>
<{include 
file="db:system_comments_nest.html"}>
<{/if}>
<!-- 
end comments loop -->
</
div>
[
b]<{/if}>[/b]

3
jakob
Re: Comments only viewable for members?
  • 2004/10/6 17:13

  • jakob

  • Just popping in

  • Posts: 14

  • Since: 2002/10/18


Hi,

It didn't work for me.

In DB%3ANewsArticle.html I found this code:

<div style="text-align: center; padding: 0px;
margin-top:3px;">
<?php echo $this->_tpl_vars['commentsnav']; ?>

<?php echo $this->_tpl_vars['lang_notice']; ?>

</div>

<div style="margin-top:3px; padding: 0px;">
<!-- start comments loop -->
<?php if ($this->_tpl_vars['comment_mode'] == 'flat'): ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include("db:system_comments_flat.html", array());
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<?php elseif ($this->_tpl_vars['comment_mode'] == 'thread'): ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include("db:system_comments_thread.html", array());
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<?php elseif ($this->_tpl_vars['comment_mode'] == 'nest'): ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include("db:system_comments_nest.html", array());
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<?php endif; ?>
<!-- end comments loop -->
</div>

When I placed the code around this section, all I saw, was that my code was visible on the page!

Sorry, I'm not a PHP/Xoops expert. Am I doing something wrong?

Jakob

4
jakob
Re: Comments only viewable for members?
  • 2004/10/6 17:16

  • jakob

  • Just popping in

  • Posts: 14

  • Since: 2002/10/18


Sorry, I got it now

Tanks!

Login

Who's Online

275 user(s) are online (196 user(s) are browsing Support Forums)


Members: 0


Guests: 275


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits