Anti Troll

Creating and modifying plugins.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anti Troll

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post 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?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post 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]);
      }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post 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.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post by Timbalu »

What happens if you use

Code: Select all

$eventData['commentform'] = false; // we dont want the {$COMMENTFORM}
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post by gimmel »

There is no hook that contains the index 'commentform' in $eventData.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post 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', '');
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anti Troll

Post 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....
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anti Troll

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cre8or
Posts: 3
Joined: Tue Aug 23, 2011 10:31 pm

Re: Disqus Ever going to work?

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Disqus Ever going to work?

Post by garvinhicking »

Hi!

The disqus plugin should work...this thread is not really about disqus, did you read it? :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply