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

Reply
 
Thread Tools
Delete PM sent before user reads it Details »»
Delete PM sent before user reads it
Version: 1.0, by pie pie is offline
Developer Last Online: Dec 2005 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 03-23-2005 Last Update: 05-26-2005 Installs: 24
DB Changes
 
No support by the author.

Update:
27th May 2005 -
Counters update on deletion. PM is now authenticated to user.

Show Your Support

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

Comments
  #32  
Old 05-04-2005, 05:20 PM
angelicGrace angelicGrace is offline
 
Join Date: Jun 2004
Location: Up in the clouds
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Question.

Ok I installed the hack and it seems to be working well. But I have a q. When you send a pm, then delete it before they read it, it still shows up in the navabar as the user having a new pm. This is what it looks like:

Welcome, Test User.
You last visited: Today at 12:53 PM
Private Messages: 1 Unread, Total 1.

I can't seem to find away to clear that up. Any suggestions?
Reply With Quote
  #33  
Old 05-15-2005, 10:28 PM
BeePee BeePee is offline
 
Join Date: Jul 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup and I tried to finally found a fix:


change the original file edit to this:

FILE EDITS:
private.php

**find
PHP Code:

        
// #############################################################################

        
if ($templatename != '')
        { 
**ABOVE ADD
PHP Code:

// ############################### delete unread pm ############################
if ($_REQUEST['do'] == "deleteunread")
{
$pm $_GET['pm'];

// check to see if it is still unread and the user hasn't dilly-dallied
        
$pmquery $DB_site->query("SELECT * FROM " TABLE_PREFIX "pm WHERE pmid='$pm'");
        
$pmnum $DB_site->num_rows($pmquery);

        if (
$pmnum == 0)
        {
            
$idname $vbphrase['private_message'];
            eval(
print_standard_error('invalidid'));
        }

    
$pmquery $DB_site->query("SELECT * FROM " TABLE_PREFIX "pm WHERE pmid=$pm AND messageread=0");
        if (
$DB_site->num_rows($pmquery) == 0)
        {
            eval(
print_standard_error('hasbeenread'));
        }
        
// check to the actual sender of the PM is the one trying to delete it. Done by chris
        
$suspectuser $bbuserinfo['userid'];
    
$senderquery $DB_site->query("SELECT userid, touserid FROM " TABLE_PREFIX "pmreceipt WHERE pmid=$pm AND readtime=0");
        
$senderresult mysql_fetch_assoc($senderquery);
        if (
$senderresult['userid'] == $suspectuser) {

        
$receiptSql "UPDATE " TABLE_PREFIX "pmreceipt SET deleted=1 WHERE pmid=$pm";
        
$DB_site->query($receiptSql);

        
$reduceunreadPmSql "UPDATE " TABLE_PREFIX "user SET pmunread=pmunread-1 WHERE " $senderresult['touserid'];
        
$DB_site->query($reduceunreadPmSql);        
        
$reducetotalPmSql "UPDATE " TABLE_PREFIX "user SET pmtotal=pmtotal-1 WHERE " $senderresult['touserid'];
        
$DB_site->query($reducetotalPmSql);        

        
$deletePmSql "DELETE FROM " TABLE_PREFIX "pm WHERE pmid=" $pm;
        
$DB_site->query($deletePmSql);        

        
$url "private.php?$session[sessionurl]do=trackpm";
        eval(
print_standard_redirect('deleted_private_messages_successfully'));
        }
        else {
        
$idname $vbphrase['private_message'];
        eval(
print_standard_error('invalidid'));
        }

If you have users which have already a PM count problem run the following querries on them depending which count is off use one of them or both for each affected user:

Code:
UPDATE user SET pmunread=pmunread-1 WHERE userid='<<recipient>>';
UPDATE user SET pmtotal=pmtotal-1 WHERE userid='<<recipient>>';
replace '<<recipient>>' with the userid nbr.

HTH
cheers
Reply With Quote
  #34  
Old 05-16-2005, 12:50 AM
angelicGrace angelicGrace is offline
 
Join Date: Jun 2004
Location: Up in the clouds
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you EVER so much!
Reply With Quote
  #35  
Old 05-16-2005, 08:47 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice one BeePee.

The $pm variable should however be sanitized to prevent a possible SQL injection.

replace:
PHP Code:
$pm $_GET['pm']; 
by
PHP Code:
$pm intval($_GET['pm']); 
Reply With Quote
  #36  
Old 05-16-2005, 01:17 PM
BeePee BeePee is offline
 
Join Date: Jul 2004
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks m8
Reply With Quote
  #37  
Old 05-16-2005, 11:26 PM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

while doing the template edits I get this error in 3.0.6:

Quote:
The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/site/public_html/forum/includes/adminfunctions_template.php(3096) : eval()'d code on line 4

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
line 3096 is:
Code:
		eval('$devnull = "' . $template . '";');
Reply With Quote
  #38  
Old 05-17-2005, 01:37 PM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does anyone know what the problem is? I find it odd that I am the first one to encounter this error, since I am adding this hack to a new forum without any other hacks installed. Is this a 3.0.6 incompatibilty issue?
Reply With Quote
  #39  
Old 05-17-2005, 02:30 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What editor did you use to change the files?
Reply With Quote
  #40  
Old 05-17-2005, 04:05 PM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
What editor did you use to change the files?
notepad2
Reply With Quote
  #41  
Old 05-17-2005, 06:06 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post a few lines before and after the line you posted above.
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 09:26 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07097 seconds
  • Memory Usage 2,332KB
  • 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
  • (2)bbcode_code
  • (4)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
  • (4)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