Anti Troll

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

Re: Anti Troll

Post by garvinhicking » Fri Jun 24, 2011 11:22 pm

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/

User avatar
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post by gimmel » Mon Jun 27, 2011 4:04 pm

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?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post by Timbalu » Mon Jun 27, 2011 7:51 pm

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

User avatar
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post by gimmel » Mon Jun 27, 2011 11:07 pm

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.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post by Timbalu » Tue Jun 28, 2011 11:08 am

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

User avatar
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post by gimmel » Tue Jun 28, 2011 11:16 am

There is no hook that contains the index 'commentform' in $eventData.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Anti Troll

Post by Timbalu » Tue Jun 28, 2011 11:36 am

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anti Troll

Post by garvinhicking » Tue Jun 28, 2011 12:55 pm

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/

User avatar
gimmel
Regular
Posts: 118
Joined: Tue Jul 25, 2006 2:44 pm
Location: Quickborn/Germany
Contact:

Re: Anti Troll

Post by gimmel » Tue Jun 28, 2011 1:13 pm

@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.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anti Troll

Post by garvinhicking » Tue Jun 28, 2011 2:07 pm

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 » Thu Aug 25, 2011 1:56 am

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Disqus Ever going to work?

Post by garvinhicking » Thu Aug 25, 2011 3:56 pm

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