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
  #22  
Old 06-13-2002, 03:26 PM
webForum webForum is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm using Mystics version on my forum and it stopped working after upgrading to v2.2.6. It seems to execute template 'standardredirect' in some way beacuse it's redirect to the post again after 1sec.

Please, can someone verify if this is working with v2.2.6.
Reply With Quote
  #23  
Old 06-13-2002, 03:50 PM
Mystics's Avatar
Mystics Mystics is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 273
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by webForum
Please, can someone verify if this is working with v2.2.6.
It's working perfect with 2.2.6

I think, you have forgotten this step:
Code:
Search for
-----------------------------------------------------------
if ($HTTP_POST_VARS['action']=="updatepost") {
-----------------------------------------------------------

REPLACE it with
-----------------------------------------------------------
if ($action=="updatepost") {
-----------------------------------------------------------
Mystics
Reply With Quote
  #24  
Old 06-13-2002, 04:03 PM
webForum webForum is offline
 
Join Date: Nov 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, you're correct. I actually leaved it out since I thought both more or less did the same thing.

Many thanks Mystics
Reply With Quote
  #25  
Old 06-19-2002, 06:39 PM
xamu's Avatar
xamu xamu is offline
 
Join Date: Feb 2002
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So really,
Code:
<input type="submit" class="bginput" name="submit" accesskey="s" value="Save Changes" tabindex="3">
Should be replaced with
Code:
<input type="submit" class="bginput" name="submit" accesskey="s" value="Save Changes" tabindex="3">
<INPUT TYPE="Submit" class="bginput" NAME="preview" ACCESSKEY="P" VALUE="Preview">
Otherwise the Preview button will not be the same size.

Probably wouldn't hurt to change the tabindex= numbers for Preview, Save Changes & Reset Message.
Reply With Quote
  #26  
Old 03-31-2003, 02:19 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For anyone still using this hack, I have fixed the problem with the signature showing for the original poster instead of the person editing the post.

Change:

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

PHP Code:
    if ($signature) {
    
$userinfo=$DB_site->query_first("
    SELECT signature
      FROM user
     WHERE userid='
$postinfo[userid]'");
      
$post[username]=$postinfo[username];
      
$post['signature'] = bbcodeparse($userinfo['signature'],0,$allowsmilie);
      eval(
"\$post[signature] = \"".gettemplate("postbit_signature")."\";");
      
$previewmessage.=$post['signature'];
    } 
It does add one query, but this is the only way to fix it AFAIK.
Reply With Quote
  #27  
Old 05-11-2003, 01:11 AM
msimplay's Avatar
msimplay msimplay is offline
 
Join Date: Aug 2002
Location: UK
Posts: 1,059
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works great on vbulletin 2.3 its a wonder why it isnt there as standard
Reply With Quote
  #28  
Old 05-23-2003, 06:45 AM
padblaz padblaz is offline
 
Join Date: Apr 2003
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very useful hack
thanks for it
Reply With Quote
  #29  
Old 08-10-2003, 12:05 PM
Kriek's Avatar
Kriek Kriek is offline
 
Join Date: Jul 2002
Location: Florida
Posts: 135
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Flawless via 2.3.0

/me clicks install
Reply With Quote
  #30  
Old 02-01-2004, 09:24 AM
Aaron1's Avatar
Aaron1 Aaron1 is offline
 
Join Date: Oct 2002
Location: Amsterdam
Posts: 200
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very cool, i installed it, the only problem what i have is that the preview of the changes of the post looks good, but in the form the changes aren't there anymore. So i need to edit it again whenever i preview the edit post.

Anyone knows what could have caused that? Very ackward! :ermm:

Ps: I am still running my faitfulll vb 2.2.7
Reply With Quote
  #31  
Old 01-28-2005, 03:31 PM
ngx's Avatar
ngx ngx is offline
 
Join Date: Jan 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mystics
It's working perfect with 2.2.6

I think, you have forgotten this step:
Code:
Search for
-----------------------------------------------------------
if ($HTTP_POST_VARS['action']=="updatepost") {
-----------------------------------------------------------

REPLACE it with
-----------------------------------------------------------
if ($action=="updatepost") {
-----------------------------------------------------------
Mystics
Installed nicely into 2.3.5 Thanks.

Just posting here to point out that that part of code isnt actually in the first post instructions So I missed it twice until I came further into the thread. just an FYI
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 11:21 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.08563 seconds
  • Memory Usage 2,359KB
  • Queries Executed 27 (?)
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
  • (7)bbcode_code
  • (10)bbcode_php
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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