Page 2 of 2
Re: Anti Troll
Posted: Fri Jun 24, 2011 11:22 pm
by garvinhicking
Hi!
when I experimented with removing COMMENTFORM (for the disqus plugin) I also experienced problems doing it the way I suggested here, which worked for you.
I am not quite sure why it would work on one installation. Could it be the order of your event plugins, or some different template?
Regards,
Garvin
Re: Anti Troll
Posted: Mon Jun 27, 2011 4:04 pm
by gimmel
I tried everything from installing all live plugins to my sandbox to removing all plugins from the live blog. Both systems differ somehow, but I don’t know how. I makes me want to tear my hear out!
Code: Select all
$serendipity['smarty']->get_template_vars('COMMENTFORM')
has content on frontend_display, but I can’t set it with
Code: Select all
$serendipity['smarty']->assign(array('COMMENTFORM'=>''))
or
Code: Select all
$serendipity['smarty']->assign('COMMENTFORM','')
Oh wait, I tried something while typing…
The comment form IS deleted but only if there are comments in the entry.
Example: With
comment /
without comments (you have to deactivate cookies to see it…)
Perhaps COMMENTFORM is only set (and editable) on the frontend_display events that output the comments?
Re: Anti Troll
Posted: Mon Jun 27, 2011 7:51 pm
by Timbalu
I haven't tried this myself, but maybe this could work?
Code: Select all
$name = 'COMMENTFORM';
if (isset($this->_tpl_vars[$name])) {
unset($this->_tpl_vars[$name]);
}
Re: Anti Troll
Posted: Mon Jun 27, 2011 11:07 pm
by gimmel
No, this doesn’t help.
I found out the reason:
Nearly no hook contains Smarty var $COMMENTFORM, only the frontend_display that shows the comments in an entry. This is the only chance to clear the $COMMENTFORM. If there are no comments, there is no comment frontend_display, so $COMMENTFORM can’t be cleared.
That’s sad, because the only other possibility is $eventData['allow_comments'] = 'false', but that shows an alert with "The author does not allow comments to this entry". I think that’s a bit too hard and noticeable for people that have cookies deactivated.
Re: Anti Troll
Posted: Tue Jun 28, 2011 11:08 am
by Timbalu
What happens if you use
Code: Select all
$eventData['commentform'] = false; // we dont want the {$COMMENTFORM}
Re: Anti Troll
Posted: Tue Jun 28, 2011 11:16 am
by gimmel
There is no hook that contains the index 'commentform' in $eventData.
Re: Anti Troll
Posted: Tue Jun 28, 2011 11:36 am
by Timbalu
Sorry, but I don't really understand what you are trying to do....
As far as I understand, you don't want {$COMENTFORM} in special cases and want to set it back.
You are complaining that there is no commenform to set back. But this is what you want, why complain ...? Confusing....
Did you try and just set back the alert if this is the only problem with
Code: Select all
$eventData['allow_comments'] = 'false';
@define('COMMENTS_CLOSED', '');
Re: Anti Troll
Posted: Tue Jun 28, 2011 12:55 pm
by garvinhicking
Hi!
In the disqus problem I solved that in the end with an ugly hack. I simply emit CSS that hides the .commentform thing....
Re: Anti Troll
Posted: Tue Jun 28, 2011 1:13 pm
by gimmel
@Timbalu:
$COMMENTFORM is a Smarty variable, it is not available in $eventData.
Surely $COMMENTFORM is defined in the core, but it is only shown in the hook frontend_display that shows comments. There it is possible to do $COMMENTFORM="". But if an entry has no comments, I have no access to $COMMENTFORM, so I can’t delete it.
Your code example is a nice idea, but you can't change a constant while runtime. That’s why they are called constants.

Even if it would work, the CSS box would be still visible.
@garvinhicking:
Nice idea, too. But the form would be visible in sourcecode. With todays browsers it's not that hard to change the CSS with developer tools.
I think I will add a Smarty variable that I can use in the entries.tpl to hide the comment form as another option. It’s not that nice and easy but it works.
Re: Anti Troll
Posted: Tue Jun 28, 2011 2:07 pm
by garvinhicking
Hi!
Yeah, the sourcecode would be there, but since you can still/also handle and reject and submitted comments, this wouldn't help the people anything if they use dev tools to change the css...
Regards,
Garvin
Re: Disqus Ever going to work?
Posted: Thu Aug 25, 2011 1:56 am
by Cre8or
I have followed the forums code by code regarding the Desqus plugin. Does it have a chance? Or should move shop to word press?
Thanks,
Jeri
Re: Disqus Ever going to work?
Posted: Thu Aug 25, 2011 3:56 pm
by garvinhicking
Hi!
The disqus plugin should work...this thread is not really about disqus, did you read it?
Regards,
Garvin