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)
-   -   Preview Private Message Before Sending (https://vborg.vbsupport.ru/showthread.php?t=32695)

bira 11-27-2001 05:00 PM

A-ha!!!!

Silly me, I found the culprit :blush:

In the hack details, I have the following code added:

Code:

    // preview hack
    $pmreceipt=iif($pmreceipt=="yes",1,0);
    // preview hack

This alters $pmreceipt's value from "yes" to "1" (which for this matter is the same thing.)

In any event, doing this fix will NOT harm your script.

JJR512 11-27-2001 05:10 PM

OK, I think it makes sense. :)

BTW, I just noticed that the name of this hack doesn't really suit what it does..."Preview Sent Private Message"...you haven't really sent the message yet, when you preview it. ;)

bira 11-27-2001 05:21 PM

yeah, it should have been 'Preview Private Message before Sending' -- but I can't change it :/

bira 11-27-2001 06:05 PM

If you haven't installed the hack, ignore this message -- the installation instructions in the first thread and the downloadable attachment txt file have been modified.


ok, found - and corrected - another bug.

Problem: if you are replying to a PM or forwarding it, the icon in the folder for that PM does not change from a regular "read PM" to a "replied to PM" or a "forwarded PM".

The reason is that if you preview a message, the values for "privatemessageid" and "forward" -- hidden fields in the form -- are not stored.

For this, we have to redclare them in the 'preview' part of the hack.

If you already installed this hack, find in private.php:

Code:

$subject = $title;
And add below or above it:

Code:

$privatemessageid = $prevmessageid;
$forward;


Admin 11-28-2001 03:00 PM

Love it, installed here. :D

Thanks. :)

bira 11-28-2001 03:06 PM

wow, thanks :)

Admin 11-28-2001 03:11 PM

Thank you. :)

One problem though, with this code:
Code:

$privatemessageid = $prevmessageid;
$forward;

If I'm not replying to a message or forwarding one, whenever I try to preview I get the error_noid message.

So I had to remove that bit for now, let us when you get a fix. :)

(and sorry about my test message :D)

bira 11-28-2001 03:27 PM

FireFly, you shouldn't remove it. I'll explain:

In the send new pm form, there are two hidden fields (original code):

Code:

<input type="hidden" name="prevmessageid" value="$privatemessageid">
<input type="hidden" name="forward" value="$forward">

These determine the behaviour of your icons in the PM folder:

if $privatemessageid has a value, then it means you are now replying to or forwarding a message. If it doesn't have a value, it means you are writing a new message.

if $privatemessageid has a value and $forward=1, it means you are forwarding a message and not replying.

These then determine which icon will be displayed in your inbox next to that message.

Now, when you click on "Reply" for a message, these values are filled.

When you hit "Preview", these values are lost.

So we need to "reinstate" them.

That's what these two lines are for:

Code:

$privatemessageid = $prevmessageid;
$forward;

From what you are telling me, I can only assume you have high error reporting set in php.ini.

For the vast majority of the people, that error won't show up because they are not in development environment with high error reporting, and functionality is not tampered.

However, if you want to be "holier than the pope" so to speak, do this instead:

PHP Code:

if ($prevmessageid) {
       
$privatemessageid $prevmessageid;
}

$forward iif($forward,1,0); 

I think this should work. Try it out and let me know :)

Cheers,

Bira

Admin 11-28-2001 03:33 PM

[QUOTE]Originally posted by bira
From what you are telling me, I can only assume you have high error reporting set in php.ini.

Wayne Luke 12-10-2001 04:11 AM

OKay.. I have installed this as well and come across another pecularity.

If you look in private.php in the "New Message" section there is this line:
PHP Code:

  if (isset($privatemessageid)) { 

Well what this does is start a check to make sure the previous message actually exists. On my version and installation of PHP even though it was set to '0' this was returning true. I had to change the line to the following to prevent a "Invalid Message Error".

PHP Code:

  if (isset($privatemessageid) and $privatemessageid!=0) { 

With that it works great. I recommend that if the error doesn't occur then use Bira's original code. If it does then make this modification.


All times are GMT. The time now is 12:51 PM.

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.01218 seconds
  • Memory Usage 1,746KB
  • 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
  • (6)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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