Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-23 13:31:33

sylverwillow
New Member
Registered: 2007-11-03
Posts: 6

removing forced preview

How can I change the forced preview for comments to optional?
I saw a plugin in the plugin directory, but the link to download it gave an error page.

Offline

#2 2007-11-23 13:53:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: removing forced preview

Hi sylverwillow,

Please read the FAQ


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2007-11-23 14:26:49

sylverwillow
New Member
Registered: 2007-11-03
Posts: 6

Re: removing forced preview

I’ve already looked there. The only answer they give on removing the preview is that you shouldn’t.

Offline

#4 2007-11-23 15:50:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: removing forced preview

Hi sylverwillow, They also say that “something else fails” as well if you do manage to disable it.

This has truly become a very FAQ. It’s been discussed here many times and was decided that the inconvenience of the ‘preview’ is a small price to pay if it means safeguarding the sites from spammers.

I understand how this behaviour might be unexpected for new txp users but legit site visitors would always want to preview their comments anyway…


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2007-11-24 10:36:08

milkshake
Member
From: Linz, Austria
Registered: 2007-06-24
Posts: 80
Website

Re: removing forced preview

colak wrote:

legit site visitors would always want to preview their comments anyway…

There are some cases where this might not be true. If you have a membership system, and users are already logged in, and you want to make posting Twitter-simple.

IMO – Have it on by default, hide the switch in advanced preferences, but don’t hardwire it and veil it in mystery.

Could anyone give some pointers what might need changing in publish/comment.php, if one were hypothetically interested in removing the forced preview ;)

(There are one or two hacks listed on textpattern.org, but these seem to have vanished into the ether.)

Offline

#6 2007-11-24 11:28:06

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Offline

#7 2007-11-24 11:35:16

milkshake
Member
From: Linz, Austria
Registered: 2007-06-24
Posts: 80
Website

Re: removing forced preview

thanks iblastoff, why didn’t I think of that? :P

Offline

#8 2007-11-24 11:50:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: removing forced preview

What might work is setting $preview to FALSE in the commentForm function, after the preview variable is extracted, but it would not surprise me if that breaks several other things so it’s definitely not recommended to do this.

Offline

#9 2007-11-24 13:38:18

milkshake
Member
From: Linz, Austria
Registered: 2007-06-24
Posts: 80
Website

Re: removing forced preview

Thanks for the hint ruud.

It seemed to be working, then it stopped. Hmm.

I had more success around line 350. Right now with the hacks below the comment is submitted/saved to the db, but none of it’s values are set (message, status).

Line 156

// by default, the submit button is visible but disabled
		// $comment_submit_button = fInput('submit', 'submit', gTxt('submit'), 'button disabled', '', '', '', '', 'txpCommentSubmit', true);
		// if all fields checkout, the submit button is active/clickable
		// if ($preview) {
			$comment_submit_button = fInput('submit', 'submit', gTxt('submit'), 'button', '', '', '', '', 'txpCommentSubmit', false);
		// }

Line 349

if ( ($evaluator->get_result() == RELOAD) ) {
			callback_event('comment.save');
			$visible = $evaluator->get_result();
			if ($visible == RELOAD) {

Last edited by milkshake (2007-11-24 13:38:32)

Offline

#10 2007-11-24 14:25:22

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: removing forced preview

milkshake, yep that’s true, because:

  • You ain’t outputting the $secret or neither the safe_insert – it’s still in the if preview-conditionals at line 91-109.
  • Also remove line 398. You won’t be able to use it anymore, so why the heck you should worry that thing.
  • Why you even edited line 349? Because the cows are flying?

And another point. If you remove commet-preview, none of the spam-productions won’t work. I mean, someone could just submit php-code inside comment just so easily. Comments could also overwrite them selves (the risk is one of the million, but even so). Error triggering will be also quite messed up then, because there ain’t any. Enjoy your cake, it tastes like a shit, but it’s yours :-)

So you should also add some own code there, like that the content would get textiled when comment is submitted. It would prevent some harms, but then all textile could be used inside the comments. It would turn all harming codesnippets in specialcharacter, until the bots or hackers submitted comment include textie-excuting :)

That’s also known risk of using TXPhorum, if you use it it’s your own risk. It also requires that all php inside articles is restricted – but that ain’t even said in TXPhorum’s documents – quite wierd ain’t it – but it won’t prevent all hacking – and neither none of the spam.

Cheers!

Last edited by Gocom (2007-11-24 14:35:23)

Offline

#11 2007-11-25 20:08:17

milkshake
Member
From: Linz, Austria
Registered: 2007-06-24
Posts: 80
Website

Re: removing forced preview

Just to clarify, I’m not suggesting anyone use this on a live site, I’m just trying to understand how the comment system works, and where the extra preview step is introduced.

From what I can tell, it seems the preview step is an intrinsic part of the comment system’s design, so would be non-trivial to disable. As has been said, it will break other stuff.

Last edited by milkshake (2007-11-25 20:09:49)

Offline

Board footer

Powered by FluxBB