Version: , by Mas*Mind
Developer Last Online: Sep 2003
Version: 2.2.x
Rating:
Released: 02-22-2001
Last Update: Never
Installs: 24
No support by the author.
This is what the hack does: It let's you preview a message when you're editing it, you can only preview when you're posting or replying the way it is now:
It works on my testserver, but I've not tested on a 'live' forum, but it seems to be working allright...
Instructions
1 Backup your editpost.php file!!! and open the original one...
Then:
after:
PHP Code:
if (!isset($action) or $action=="") {
$action="editpost";
}
insert:
PHP Code:
if($preview AND $action="updatepost")
$action = "editpost";
after:
PHP Code:
if ($action=="editpost") {
// draw nav bar
$navbar=makenavbar($threadinfo[threadid],"thread",1);
if ($checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid='$userinfo[userid]' AND threadid=$threadinfo[threadid]")) {
$emailchecked="CHECKED";
} else {
$emailchecked="";
}
with:
PHP Code:
if(!$preview)
$email=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$userinfo[userid] AND threadid=$threadinfo[threadid]");
$emailchecked=iif($email,"CHECKED","");
Make a new template called 'editpost_postpreview' with the following content:
I have installed it, but ist doesn?t work correct.
I can have a first preview and it works, but if I try to preview again, it posts the message. Any ideas?
1. You do not need a separate template (editpost_postpreview). The contents of the existing template, newpost_postpreview, are almost exactly the same, but are a bit more polished in terms of HTML coding (including being the standard vBulletin table-within-a-table which I guess gives you the border or whatever). Plus, using the existing template saves space (even if only a tiny amount) in the database. (I tested that doing this works, and can confirm that it does indeed work properly to use the existing template. All you have to do is first of all, not create the new template, or delete it if you already did, then in editpost.php, change the part you added that says "editpost_postpreview" so that it says "newpost_postpreview".)
2. Whenever making a vBulletin .php file use a template it didn't use before, you should add it to the "$templateused" section at the top of the file. I'm told this saves a database query. You should do this regardless of what you do about my #1 above.
3. When you click the button to edit a post, then you click the Preview button, the edit is submitted and saved to the database. This means that whatever changes you made are saved before you tell it to save them! This is not the desired behavior of the Preview function. If you want to "preview" something, that means you want to see what it looks like, before you commit to it, right? Well, the mere act of previewing something now means you've committed the changes! This is not good.
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
sorry guys, this was a beta for 2.01 if I'm correct. I've never tested it fully and never really released it fully (don't know why it says v2.2.2 before the title)
currently there's no change for me to work on this, so if a fellow hacker wants to do it: great
Originally posted by Mystics I have fixed this long time ago, sorry I haven't posted it
It works perfect for vB2.2.x!
@JJR512
We had the same thoughts, I also have just used the newpost_postpreview Template.
I have attached the fixed version.
Thanks a lot, Mystics !! Great upgrade.
I installed perfectly without any problem.
Just a couple of little things:
1) When an admin (me, for instance...) is previewing after edit an other user's post, the signature showed in preview mode is mine, instead of the user's one. When saved, everything works fine, as usual.
2) Html style question: how can I make the 'save changes' button selected by default as it was before adding a button just before ? I tried with 'tabindex' but ...