Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Mas*Mind Mas*Mind is offline
Developer Last Online: Sep 2003 Show Printable Version Email this Page

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); 
insert:

PHP Code:
  if($preview)
  { 
$parseurl=iif($parseurl=="yes",1,0);
      
$email=iif($email=="yes",1,0);
      
$allowsmilie=iif($disablesmilies=="yes",0,1);
      
$signature=iif($signature=="yes",1,0);
    
    
$previewmessage=$message;
    
    if (
$parseurl) {
      
$previewmessage $postinfo[message]=parseurl($previewmessage);
      }
    
    
$previewpost=1;
    
$previewmessage=bbcodeparse($previewmessage,$foruminfo[forumid],$allowsmilie);
    
$postinfo[message]=$message;    

    if (
$signature) {
      
$previewmessage.=bbcodeparse("\n__________________\n$bbuserinfo[signature]",0,$allowsmilies);
    }

    eval(
"\$postpreview=\"".gettemplate("editpost_postpreview")."\";");

    
$parseurlchecked=iif($parseurl,"checked","");
    
$postinfo[allowsmilie] = $allowsmilie;
    
$postinfo[showsignature] = $signature;
    
$postinfo[iconid] = $iconid;
    
$postinfo[title] = $title;
    
$previewchecked=0;
  }
  else{
       
$postinfo[message]=htmlspecialchars($postinfo[pagetext]);
    
$parseurlchecked="CHECKED";
  } 
Replace:

PHP Code:
 $postinfo[message]=htmlspecialchars($postinfo[pagetext]); 
with:

PHP Code:
//$postinfo[message]=htmlspecialchars($postinfo[pagetext]); 
replace:

PHP Code:
   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:

Code:
 <table width=100% border=0 cellspacing=1 cellpadding=4>
<TR bgcolor="#6c6081">
<TD valign=middle><smallfont color="#afa3c5"><B>Post Preview:</B></smallfont></TD>
</TR>

<tr bgcolor="#DEDEDE">
<td><normalfont>$previewmessage</normalfont></td>
</tr>
</table>

<br>
then edit your 'editpost' template:

insert the '$postpreview' variable at the appropiate place (look into the 'newthread' template for an example)

and replace:

Code:
<INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">
with:

Code:
<INPUT TYPE="Submit" NAME="preview" ACCESSKEY="P" VALUE="Preview">
<INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">
All done! Enjoy

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-07-2002, 10:12 PM
T?Pau T?Pau is offline
 
Join Date: Jan 2002
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #13  
Old 02-12-2002, 05:10 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Three comments about this hack:

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.
Reply With Quote
  #14  
Old 02-12-2002, 10:32 AM
Mas*Mind's Avatar
Mas*Mind Mas*Mind is offline
 
Join Date: Oct 2001
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #15  
Old 02-12-2002, 10:48 AM
Mystics's Avatar
Mystics Mystics is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 273
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #16  
Old 02-12-2002, 04:56 PM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Mystics
I have fixed this long time ago, sorry I haven't posted it
It works perfect for vB2.2.x!
This works great. Thanks, Mystics! :up:
Reply With Quote
  #17  
Old 02-12-2002, 05:11 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep, works fine now!
Reply With Quote
  #18  
Old 02-12-2002, 08:14 PM
Lucky Lucky is offline
 
Join Date: Dec 2001
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great on 2.2.2.

Thanks.
Reply With Quote
  #19  
Old 02-13-2002, 11:08 AM
Jawelin Jawelin is offline
 
Join Date: Nov 2001
Posts: 557
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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 ...

Thanks a lot.
Bye
Reply With Quote
  #20  
Old 04-23-2002, 09:35 AM
DWZ's Avatar
DWZ DWZ is offline
 
Join Date: Dec 2001
Posts: 207
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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.
I just tried to install this hack on 2.2.5 but, I cant find the code
Code:
<INPUT TYPE="Submit" NAME="SUBMIT" ACCESSKEY="S" VALUE="Submit Now">
in the editpost template... Has it been changed to somthing else?

I found this:
Code:
<input type="submit" class="bginput" name="submit" accesskey="s" value="Save Changes" tabindex="3">
I dont know if thats it or not, so yeah...

Thanks

Alan (DWZ)
Reply With Quote
  #21  
Old 04-23-2002, 01:29 PM
Mystics's Avatar
Mystics Mystics is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 273
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by DWZ
I found this:
Code:
<input type="submit" class="bginput" name="submit" accesskey="s" value="Save Changes" tabindex="3">
I dont know if thats it or not, so yeah...
Yes, that's the right code.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:45 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04808 seconds
  • Memory Usage 2,347KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (8)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete