PDA

View Full Version : Delete PM sent before user reads it


pie
03-23-2005, 10:00 PM
Update:
27th May 2005 - Counters update on deletion. PM is now authenticated to user.

Make a donation
(https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=pie%40artorg%2eco%2euk&no_shipping=0&no_note=1&tax=0&currency_code=GBP)

pie
03-24-2005, 10:03 PM
Whoops, wrong forum. lol. Will get a mod to move it.

Sin City
03-24-2005, 11:11 PM
when i saw it in the vB2 section i was like "why not for vB3? :(" then i seen it's just in the wrong area ;)

been looking for this.... thanks :)

yinyang
03-25-2005, 03:23 AM
wow, this is awesome. i wish this existed for email. damn there's been a lot of emails to ex girlfriends i wish i could have deleted through yahoo..........

Erwin
03-25-2005, 04:01 AM
It's a good idea. :)

nexialys
03-25-2005, 08:37 AM
3 installs, and none to tell there is a major bug in it... funny how guys click easily.. lol

good hack PIE... but your "WHERE" in the queries are sticked with the rest, so the queries are not correct...

and why this first query about the pmreceipt ?! it's not used elsewhere in this hack...

Boofo
03-25-2005, 11:19 AM
3 installs, and none to tell there is a major bug in it... funny how guys click easily.. lol

good hack PIE... but your "WHERE" in the queries are sticked with the rest, so the queries are not correct...

and why this first query about the pmreceipt ?! it's not used elsewhere in this hack...

How would you suggest he fix it, sir? ;)

nexialys
03-25-2005, 11:41 AM
How would you suggest he fix it, sir? ;)
it's already answered in my post... need spaces...
* nexialys lurk at Boofo with a strange look... are you laughing at me ?!

Boofo
03-25-2005, 12:01 PM
it's already answered in my post... need spaces...
* nexialys lurk at Boofo with a strange look... are you laughing at me ?!


Laughing at you? hahahahahahahaha No way, sir. ;)

Boofo
03-25-2005, 12:02 PM
Whoops, wrong forum. lol. Will get a mod to move it.

Can you please put this in a txt file so others can download it and have it in case they ever need to re-install it? ;)

pie
03-26-2005, 06:27 AM
Can you please put this in a txt file so others can download it and have it in case they ever need to re-install it? ;)
Sure.

pie
03-26-2005, 06:35 AM
3 installs, and none to tell there is a major bug in it... funny how guys click easily.. lol

good hack PIE... but your "WHERE" in the queries are sticked with the rest, so the queries are not correct...

and why this first query about the pmreceipt ?! it's not used elsewhere in this hack...
Yes it is... its where it displays Delete Unread PM (...?)

And what do you not like about my query? I have to admit i just copied the code from PHPMYADMIN as I was being lazy.

Thanks everyone by the way for the kind words.

Can you please put this in a txt file so others can download it andhave it in case they ever need to re-install it?DONE!!

nexialys
03-26-2005, 09:37 AM
@pie... it's not i don't like the query, but it's badly written:
$pmquery=$DB_site->query("SELECT* FROM " . TABLE_PREFIX . "pmWHEREpmid='$pm'");have to be$pmquery=$DB_site->query("SELECT * FROM " . TABLE_PREFIX . "pm WHERE pmid='$pm'");that's all... they are all the same, missing some spaces between elements... easy to see anyway, the code will not work if you don't add the spaces...

Oblivion Knight
03-26-2005, 09:57 AM
that's all... they are all the same, missing some spaces between elements... easy to see anyway, the code will not work if you don't add the spaces...I assume this was a WYSIWIG issue of some kind, as the text file has the queries written fine.. ;)

pie
03-26-2005, 11:55 AM
@pie... it's not i don't like the query, but it's badly written:
$pmquery=$DB_site->query("SELECT* FROM " . TABLE_PREFIX . "pmWHEREpmid='$pm'");have to be$pmquery=$DB_site->query("SELECT * FROM " . TABLE_PREFIX . "pm WHERE pmid='$pm'");that's all... they are all the same, missing some spaces between elements... easy to see anyway, the code will not work if you don't add the spaces...
Updated

Boofo
03-26-2005, 12:35 PM
Would there be a way to show us exactky what edits need to be made to the pm_receiptsbit template for those that have been altered from the original instead of just replacing the template?

pie
03-27-2005, 10:34 PM
I will sort that A.S.A.P.

pie
03-27-2005, 10:37 PM
Updated

why-not
03-28-2005, 06:02 PM
How about adding a userid to the query! Sure it would be difficult to know who has unread PM(s), but all one has to do is start sending requests with PM ids and they can delete all unread PM(s) even ones that are not theirs! Then you should also check the request, because allowing what you allow, can end up with anyone reading any table they want or even delete your whole database! Nice idea, but it needs to be made secure!

Sonia

hate
03-28-2005, 06:09 PM
This is a nice idea, but the trouble is to many have email when pm, so if they get a email saying so and so pmed them, they will go to their pm box and find nothing.

That is the only draw back stoping me from using it.

Boofo
03-28-2005, 06:25 PM
How about adding a userid to the query! Sure it would be difficult to know who has unread PM(s), but all one has to do is start sending requests with PM ids and they can delete all unread PM(s) even ones that are not theirs! Then you should also check the request, because allowing what you allow, can end up with anyone reading any table they want or even delete your whole database! Nice idea, but it needs to be made secure!

Sonia

How would you do that exactly? ;)

nexialys
03-28-2005, 06:29 PM
the best way would be to have a dropdown with multiple choices where you select the users that need to be deleted from the list of receiving the pm ... so if there is only one receiver, the dropdown will be a single choice... if we choose nobody, no pm will be deleted...

pie
03-29-2005, 01:30 AM
How about adding a userid to the query! Sure it would be difficult to know who has unread PM(s), but all one has to do is start sending requests with PM ids and they can delete all unread PM(s) even ones that are not theirs! Then you should also check the request, because allowing what you allow, can end up with anyone reading any table they want or even delete your whole database! Nice idea, but it needs to be made secure!

Sonia
Very good point... I have to say silly me for not doing it.

That is the only draw back stoping me from using it.
Theres nothing that can be done about that, unfortunatly you can't pull back emails. I could do a "This PM has been deleted" error message if you guys'd prefer.

the best way would be to have a dropdown with multiple choices where you select the users that need to be deleted from the list of receiving the pm ... so if there is only one receiver, the dropdown will be a single choice... if we choose nobody, no pm will be deleted...
Thats a good idea, the fact that it could be for mulitple users completly slipped my mind. I'd probally do checkboxes rather than a list purely because i find checkboxes easier and I want them as easy as possible.

Dennis Olson
03-29-2005, 04:06 PM
A couple of points:

1) The delete function LEAVES the tracking notice in your tracking folder. How can that be removed at the same time? (After all, you don't need the tracking notice anymore).

2) You create the following phrase:

Phrase Type: Private Messaging
Varname: was_deleted
Text: You deleted it!

but in your EVAL statement, you use:

eval(print_standard_redirect('deleted_private_mess ages_successfully'));

Thus never referencing that phrase....

pie
03-29-2005, 05:16 PM
A couple of points:

1) The delete function LEAVES the tracking notice in your tracking folder. How can that be removed at the same time? (After all, you don't need the tracking notice anymore).

2) You create the following phrase:

Phrase Type: Private Messaging
Varname: was_deleted
Text: You deleted it!

but in your EVAL statement, you use:

eval(print_standard_redirect('deleted_private_mess ages_successfully'));

Thus never referencing that phrase....
Yes. This hack is still not 100% Featured, I will be adding it so that in the Sent Messages folder, it'll show that it was deleted and thus didn't get through.

DivisionByZero
04-03-2005, 03:16 AM
A couple of points:

1) The delete function LEAVES the tracking notice in your tracking folder. How can that be removed at the same time? (After all, you don't need the tracking notice anymore).

I would like to leave the tracking message just to remind the sender that he deleted it. But, I would like to have the "Delete Their PM!" link removed. The way it stands now, if the sender deletes the PM, the "Delete Their PM" link is still active. This could be gotten rid of to prevent an error message.

DivisionByZero
04-03-2005, 05:03 AM
Ok, in the meantime, while pie works on the authenticate_sender_before_delete scheme, I added a quick fix to it. It's simple.. It replaces the entire request routine and here it is:

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

$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_mess ages_successfully'));
}
else {
$idname = $vbphrase['private_message'];
eval(print_standard_error('invalidid'));
}
}

DivisionByZero
04-03-2005, 05:18 AM
To replace the "Delete Their PM!" link if the PM has already been deleted by the sender, do the following:

In private.php, find

$pmreceipts = $DB_site->query("
SELECT
pmreceipt.*, pmreceipt.pmid AS receiptid
FROM " . TABLE_PREFIX . "pmreceipt AS pmreceipt
WHERE pmreceipt.userid = $bbuserinfo[userid]
ORDER BY pmreceipt.sendtime DESC
");

Replace with:
$pmreceipts = $DB_site->query("
SELECT
deleted, pmreceipt.*, pmreceipt.pmid AS receiptid
FROM " . TABLE_PREFIX . "pmreceipt AS pmreceipt
WHERE pmreceipt.userid = $bbuserinfo[userid]
ORDER BY pmreceipt.sendtime DESC
");

The pm_receiptsbit template replacement string should be changed to:
<td class="alt2"><span class="smallfont"><if condition="$show['readpm']">$receipt[read_date] <span class="time">$receipt[read_time]</span><else /><em>$vbphrase[unread_date]<br /><if condition="$receipt[deleted] == '0'"><a href="private.php?$sesion[sessionurl]do=unsend&amp;pm=$receipt[receiptid]">$vbphrase[deleteunread]</a><else />$vbphrase[was_deleted]</if></em></if></td>

pie
04-12-2005, 10:05 PM
You saying you want an Undelete?

DivisionByZero
04-12-2005, 11:29 PM
No, i noticed now if a user deletes the PM WITHOUT reading it, the receipt should be processed as "confirmed" and not have the "delete their pm" availability anymore. :)

angelicGrace
05-04-2005, 05:20 PM
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?

BeePee
05-15-2005, 10:28 PM
Yup and I tried to finally found a fix:


change the original file edit to this:

FILE EDITS:
private.php

**find

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

if ($templatename != '')
{

**ABOVE ADD

// ############################### 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_mess ages_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:


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

angelicGrace
05-16-2005, 12:50 AM
Thank you EVER so much! :)

Marco van Herwaarden
05-16-2005, 08:47 AM
Nice one BeePee. :D

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

replace:
$pm = $_GET['pm'];
by$pm = intval($_GET['pm']);

BeePee
05-16-2005, 01:17 PM
Thanks m8 ;)

yoyoyoyo
05-16-2005, 11:26 PM
while doing the template edits I get this error in 3.0.6:

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: eval('$devnull = "' . $template . '";');

yoyoyoyo
05-17-2005, 01:37 PM
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?

Marco van Herwaarden
05-17-2005, 02:30 PM
What editor did you use to change the files?

yoyoyoyo
05-17-2005, 04:05 PM
What editor did you use to change the files?notepad2

Marco van Herwaarden
05-17-2005, 06:06 PM
Please post a few lines before and after the line you posted above.

dsboyce8624
05-18-2005, 01:26 AM
Okay, I love this idea, but could somebody who is just a tad bit smarter than me, like Gomer Pyle, combine the idea of cleaning up the count on the receivers end, and removing the tracking receipt on the senders end.

I see both ideas in here, but no place where both are combined.

Dennis

dsboyce8624
05-19-2005, 05:38 PM
Okay, I love this idea, but could somebody who is just a tad bit smarter than me, like Gomer Pyle, combine the idea of cleaning up the count on the receivers end, and removing the tracking receipt on the senders end.

I see both ideas in here, but no place where both are combined.

Dennis

Anybody?

pie
05-27-2005, 04:15 PM
This is what I sent out to everyone...

Hey,

Sorry I haven't updated the hack recently, work is hectic as always.

New Features:
User is authenticated to being the sender.
The private messages counter is now updated.

Cheers
Pie

dsboyce8624
05-27-2005, 10:56 PM
Thank you very much.

Going for it.

EDIT: Okay everything on the senders end seems to work fine, but the receivers count does not reset.

I manually ran the line from your code that should do it, and it worked. It must not be executing. But I have no idea why.

Unless I screwed up, which I may have.

Please let me know.

Thanks,

Dennis

pie
05-27-2005, 11:43 PM
Hmm... Will wait till a few more people respond as it's all working fine on my test board.

dsboyce8624
06-01-2005, 02:11 PM
Well, either nobody else is having trouble, or nobody new has installed.

Either way I probably screwed something up.

I'll go over it again.

GSX-Racing
06-02-2005, 04:48 AM
I did everything in the txt file, but something either isn't right, or I screwed up. Too bad, that is one feature that phpbb had that I wish VB did.

dsboyce8624
06-02-2005, 03:10 PM
I did everything in the txt file, but something either isn't right, or I screwed up. Too bad, that is one feature that phpbb had that I wish VB did.

So what's happening wrong?

dsboyce8624
06-10-2005, 04:11 PM
Pie hasn't been here in several days, which is less disheartening than just plain being ignored.

So consider this a polite bump.

Marco van Herwaarden
06-10-2005, 08:08 PM
Pie has also not been online on IRC for a couple of days i think. Guess he is on a holiday.

yoyoyoyo
06-10-2005, 08:10 PM
Why do I get a Security Error "Domain Name Mismatch" for static.paypal.com in Firefox when attempting to load this page of this thread on vbulletin.org????

dsboyce8624
06-10-2005, 09:10 PM
Pie has also not been online on IRC for a couple of days i think. Guess he is on a holiday.

Marco, any ideas why with this version of the code, the receivers post count would not be correctly reduced?

I only ask because I see you analyze every other hack and help with corrections.

Dennis

GSX-Racing
06-10-2005, 10:57 PM
I'm going to try this again tonight or tomorrow I think.

I might not have did the alter table part correct last time.

I'll keep you updated how it goes.

Thanks for keeping this topic alive for me.

GSX-Racing
06-11-2005, 05:56 AM
Can anyone tell me what the query would be to delete the mod if it does't work for me.

Just in case I need to uninstall it?

If I download the txt file now, it should be the one without the bugs?

dsboyce8624
06-11-2005, 06:09 AM
I would wait till pie comes back and figures out the count change issue.

yoyoyoyo
06-11-2005, 11:36 AM
Why do I get a Security Error "Domain Name Mismatch" for static.paypal.com in Firefox when attempting to load this page of this thread on vbulletin.org????It seems to be fixed now- it apparently was the donation link that had not been set properly.

GSX-Racing
06-16-2005, 05:43 AM
Really wanting to install this, but want to make sure all the bugs are out before I do.

Is the current txt file the final release and working fine?

Pie? Anyone that has installed lately?

sketch42
07-14-2005, 06:40 AM
can this be modified to edit the pm before it is read?

chariotdriver
07-14-2005, 08:59 PM
Hello,

I have installed this mod on 3.0.7 but I do not get the checkbox to delete the pm message. I have changed the template pm_receiptsbit which should according to me should show the extra checkbox but no go.

Does anyone has an idea how to fix this or at least know what is wrong?

Thanks in advance,

DivisionByZero
08-03-2005, 07:10 AM
any idea on a 3.5.0 status?

Paul M
08-05-2005, 10:29 PM
pie

Last Online:
Jun 2005Not really very promising for this version or 3.5.0.

Boofo
08-06-2005, 12:08 PM
Can't be that hard to make a plug-in for this. ;)

DivisionByZero
10-05-2005, 05:34 AM
3.50.... a MUST :)

DivisionByZero
12-26-2005, 04:03 PM
lalalalala

pie
12-26-2005, 04:13 PM
Anyone who wants to carry on this hack is ok to do so. Use my code or whatever, just credit me.

akanevsky
12-26-2005, 06:44 PM
How about making this a product? o.O

EDIT: Ok fine then, I'll carry it on.

AquilaEagle
12-26-2005, 06:50 PM
Wanted this, thanks :)

akanevsky
12-26-2005, 07:59 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=103791" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=103791</a>
(no credit for pie because hack was written from scratch)

Boofo
12-26-2005, 09:32 PM
https://vborg.vbsupport.ru/showthread.php?t=103791
(no credit for pie because hack was written from scratch)

But giving credit for the idea would be appropriate and a nice gesture.

pie
12-26-2005, 09:35 PM
Im not bothered, sorry I didn't say it sooner though. Glad it's been passed on. Unfortunatly i've left foruming for other things. But good luck all.

Boofo
12-26-2005, 11:06 PM
Im not bothered, sorry I didn't say it sooner though. Glad it's been passed on. Unfortunatly i've left foruming for other things. But good luck all.

You don't have a site anymore?

pie
12-26-2005, 11:18 PM
Dave runs ArtOrg at the moment., he's got some great ideas and I don't have the time so i'll sit back and let him run wild :). I have sites ZachInglis.com (http://www.zachinglis.com) and soon LT3media (http://www.lt3media.com), I've taken a back seat. I've been foruming a good 7 years and I moved onto blogging. I have passions I wish to do. Foruming was a good fun experience but my main passion lies in designing and usability and I want to do them in different mediums on the web. A fresh change

akanevsky
12-27-2005, 12:14 AM
But giving credit for the idea would be appropriate and a nice gesture.

You are right. Done. :)

DivisionByZero
01-31-2006, 05:02 PM
I've taken this hack and redid it for 3.5.3 exactly as pie coded it... I'm also adding a few nice touches to it as well...

https://vborg.vbsupport.ru/showthread.php?t=106819

Chadi
04-13-2006, 10:34 PM
[edit wrong post]

precharge
08-03-2006, 07:22 AM
There is no Front-End Error Messages phrase types, do you create that?

LCPGUY
08-24-2006, 01:22 AM
Does this work with 3.5 or 3.6?

DivisionByZero
09-02-2006, 02:52 PM
Does this work with 3.5 or 3.6?
yes. my version does, at least. I removed all my hacks at one point, but I'll be putting them back in the next couple days.

Would you like me to email this to you?

rainyleaves
09-09-2006, 03:09 AM
wow, this is awesome!!! Thanks Pie^^

rainyleaves
09-09-2006, 06:21 AM
I installed.
I have some problem in VB3.0.3..
Just click 'Delete their PM' and then now change blank page and PM does not deleted .
'Address : ...forums/private.php?do=deleteunread&pm=8649'

How can I fix them?

Please help Someone or Pie ...

LCPGUY
11-22-2006, 04:15 PM
yes. my version does, at least. I removed all my hacks at one point, but I'll be putting them back in the next couple days.

Would you like me to email this to you?

Yes!!! Please email it to me as I can't find it here.

Thanx,

John