|Title||How to Force Previewing?|
|Date||Friday August 08 2003, @03:30PM|
An anonymous user writes: "I'd like to see an option added to enable a user to force themselves to preview a post before they actually post the comment. At the moment, a user is required to preview a story submission before they post it, but there is no way for this requirement to be there for standard posts. I often find myself hitting 'submit' when I wish I'd previewed first. I know that a 'force post preview' option could be added to the options section and implemented in SLASH *very* easily, which would simply remove the 'Submit' button from the initial post screen... so could someone do it? I'd do it myself if I was able to update the CVS source
You can do it yourself.
Grab a fresh checkout of the CVS source. Then open up themes/slashcode/templates/ edit_comment;comments;default. The Submit button appears here:
[% IF !user.is_anon || (user.is_anon && preview) %]
<INPUT TYPE="SUBMIT" NAME="op" VALUE="Submit">
[% END %]
The "preview" value is true if and only if the user has already previewed. So this means the "Submit" button appears on the first editing page if the user is logged in, or on the second and successive pages whether the user is logged in or not.
That's the default behavior of Slash, but there's no reason you need to accept it if it doesn't work for you.
Edit the file to change the logic yourself -- if you never want a Submit button on the first screen, you probably just want this:
[% IF preview %]
Or if you want only admins to be able to Submit on the first try, maybe change user.is_anon to (!user.is_admin). Or subscribers, or phase of the moon... it's up to you.
Anyway, then save the file right there, within your CVS tree. Do your normal "make install" procedure.
Then you'll want to do a "template-tool -u yourvirtuser -U". This will replace all the templates in your site's DB with the templates in the theme and plugins as you've edited them in your theme tree on disk and as copied into
If you haven't been doing this with templates before, and if you have edited templates just in the DB and not on disk, you'll want to put a -t on the command line of that template-tool command, so it will tell you what's different instead of just overwriting all your hard work.
The point is that by editing the file in your cvs checkout, you can continue to take advantage of continued changes and improvements while still keeping your changes. If there are collisions, you'll be told about them when you do a "cvs update".
printed from Slashcode, How to Force Previewing? on 2012-02-07 00:22:07