vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Editpost preview (https://vborg.vbsupport.ru/showthread.php?t=9569)

Mas*Mind 02-22-2001 10:00 PM

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

02-23-2001 09:03 PM

I'll be working on the pm-preview btw

02-24-2001 06:05 PM

No-one's interested?

02-24-2001 07:55 PM

Sure i will use them both, I just wasn't doing much with hacks yet until 2.0 is released. I didn't want a beta 3 to come out and have to re-hack a bunch of stuff.

It would be great if you wrote a upgrade script that you ran and it automatically fixed the things, that way you could just update the script for each beta released.

ThomasP 07-11-2001 06:01 AM

Hi there,

hopefully didn't overlook something in between,
but I definetely would appreciate to use that hack!

Does it work for 2.0.1?
Did you have a solution meantime for PM Preview - I know there's a hack, just interested if you worked on it, too.

Thanks,
-Tom

Minimazz 01-20-2002 01:19 PM

Yes Mas*Mind, I am very interrested in that hack !

I run v 2.2.1 is your hack fixed for that version ?

any update since your former post ?

waiting for news, see you

Shenlong 01-20-2002 02:28 PM

great hack Mas*Mind

Stretchr 01-26-2002 12:50 AM

Thanks Mas*Mind! I really missed having the ability to preview my edited posts, especially when I'm using vB code. I keep finding myself using HTML instead and then I have to go in again and edit. This is a really good idea!

LuBi 02-06-2002 09:15 PM

Does this work on 2.2.2?

bitbender 02-07-2002 12:47 AM

Sweet Work!


All times are GMT. The time now is 01:56 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.01078 seconds
  • Memory Usage 1,760KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (8)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete