The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
![]() |
|||||||||||||||||||||||||||
[VB3 RC3] Attachments in private messages
![]() Developer Last Online: Jul 2014 ![]() ![]()
Unsupported. VB3.5 version is here:
https://vborg.vbsupport.ru/showthread.php?t=91220 Tested on 3.0.3 This hack enables you to send attachments in a private message. This feature was really useful to me in vb2 and I kind of missed it on vb3 so I rehacked it myself. When a user writes a private message they will be given the option to add an attachment, the same as when writing a post. It uses the same rules you have defined for a convencional attachment including file types, quotas, etc. It is only an extension for attachments to be used in private messages. As always it is advised to backup your files before hacking in case you want to go back, this is some big hack including modification of multiple files, some templates and adding two extra columns in the database tables. Instructions are provided in the txt, and some screenshots on where the attachment option appears. Info for hackers: You may modify, improve, upgrade, redistribute this hack, include it in another hack or yours or translate it provided you do it free of charge and you distribute it in www.vbulletin.org at least, there is no need to pm me asking for permission Some portions of the code are (c) Jelsoft Enterprises Ltd. Edit by MarcoH64: Because of multiple requests to make this hack work on vB3.0.7 i created upgrade instructions. These upgrade instructions can be followed after the original instructions (the 3.0.3 version). The original coder can not be held responsible for my modification. Show Your Support
|
Comments |
#2
|
|||
|
|||
![]()
Nice one..
|
#3
|
||||
|
||||
![]()
Thank you. Now I donm't have to mess with it. I was just asking about this today over there.
![]() |
#4
|
||||
|
||||
![]()
Great work, will definitely use this.
|
#5
|
||||
|
||||
![]()
Is there a way to maybe add a settings group for this like a limit on how many attachments you can have (not dependent on the regukar attachmnets settings for posts)? I really hate to tie up the db with a lot of leftover attachmnets in the pm area. Maybe even have a usergroup option to only allow certain usergroups to use it. Might make them want to do better to move up and be able to access this.
![]() |
#6
|
|||
|
|||
![]()
very nice! I was wondering if anyone would release this for vB3
![]() thanks for the hack! [high]* MGM clicks Install [/high] MGM out |
#7
|
||||
|
||||
![]()
Are the attachments still under control of the admin within the admincp?
If not you maybe have a problem finding unwanted or double sent attachments. |
#8
|
|||
|
|||
![]()
I looked over the code and coundn't find a code that deletes the attachments when the pm's are deleted. Currently, all attachments stay on the computer or mysql database permanatly unless deleted manually.
|
#9
|
||||
|
||||
![]() Quote:
![]() |
#10
|
||||
|
||||
![]() Quote:
I'll look into it and release a fix for that later today. |
#11
|
||||
|
||||
![]()
Does the regular attachments work the same way, or are they doing an unset?
|
#12
|
||||
|
||||
![]() Quote:
In private messages it is a little more tricky because the same private message can be reused between multiple recipients, so we need to make sure that nobody needs the pmtext. Vbulletin does it by using an hourly cleanup to delete all orphan pmtext, I made it delete the attachments there also. ################################################## ################# # Code modifications in file "includes/cron/cleanup2.php" ################################################## ################# ------------------------------------------------------------------- at line 81, search for this code: ------------------------------------------------------------------- Code:
$pmtextids = '0'; while ($pmtext = $DB_site->fetch_array($pmtexts)) { $pmtextids .= ",$pmtext[pmtextid]"; } $DB_site->query("DELETE FROM " . TABLE_PREFIX . "pmtext WHERE pmtextid IN($pmtextids)"); } $DB_site->free_result($pmtexts); change it to: ------------------------------------------------------------------- Code:
$pmtextids = '0'; $pmtextidsAttach = ""; $pmtextAttach = array(); while ($pmtext = $DB_site->fetch_array($pmtexts)) { $pmtextids .= ",$pmtext[pmtextid]"; $pmtextAttach[] = $pmtext[pmtextid]; } $pmtextidsAttach = implode(",",$pmtextAttach); $DB_site->query("DELETE FROM " . TABLE_PREFIX . "pmtext WHERE pmtextid IN($pmtextids)"); } $DB_site->free_result($pmtexts); // Attachments for orphaned pmtext records are removed // Let's be very careful with this delete, a delete from attachment where private IN (0) will purge all non-private attachments // that's why an extra $pmtextidsAttachments is created instead of reusing the old one if ($pmtextidsAttach) { if ($vboptions['attachfile']) { $attachments = $DB_site->query(" SELECT attachmentid, userid FROM " . TABLE_PREFIX . "attachment WHERE private IN (".$pmtextidsAttach.") "); while ($attachment = $DB_site->fetch_array($attachments)) { $ids["$attachment[attachmentid]"] = $attachment; } require_once('./includes/functions_file.php'); delete_attachment_files($ids); } $DB_site->query("DELETE FROM " . TABLE_PREFIX . "attachment WHERE private IN (".$pmtextidsAttach.")"); } Code:
ALTER TABLE attachment add index (private); The .txt is also updated with this changes. You only need to apply them if you downloaded the txt before this post was made. |
#13
|
||||
|
||||
![]() Quote:
Well, maybe someone else would hack it, I don't think I will be doing this one as I like how it works right now. |
#14
|
||||
|
||||
![]()
Thank you, sir.
![]() |
#15
|
|||
|
|||
![]()
I am having problems with this...
I am sure i have followed all instructions... I am able to send the attachments, but the recipient does not receive them... And when I view trhe attachments i have posted in the user cp, it shows, In Progress... Have i dont something wrong? |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|