![]() |
[VB3 RC3] Attachments in private messages
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. |
Nice one..
|
Thank you. Now I donm't have to mess with it. I was just asking about this today over there. ;)
|
Great work, will definitely use this.
|
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. ;)
|
very nice! I was wondering if anyone would release this for vB3 :p
thanks for the hack! [high]* MGM clicks Install [/high] MGM out |
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. |
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.
|
Quote:
|
Quote:
I'll look into it and release a fix for that later today. |
Does the regular attachments work the same way, or are they doing an unset?
|
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:
change it to: ------------------------------------------------------------------- Code:
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. |
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. |
Thank you, sir. ;)
|
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? |
Quote:
Is there a way to limit this to like the admin and/or mods or userid 1 and 2 or something like that then? Maybe a template condition? |
You're using detailed time on your board, right? That is what it means by in progress. Have you tried to click on any of the attachments in the usercp? I have and they are there and show up fine. ;)
|
Quote:
In the user cp they do show up fine, but the problem is that the recipient of the PM does not receive the attachment... I can send it find with no errors, but the user doesn't receive it... |
Quote:
However, I don't have any problem with viewing my attached file in the private message, are you sure you have this code around line ~1371? That's the one responsible for fetching the attachments. Code:
if ($pm['attach']) |
Quote:
Attachments in normal post do show fine... |
Try sending yourself an attachment and see what that does.
|
Quote:
I can send you my private.php if you want. |
Quote:
if ($pm['attach']) { and the "}" at the end, ej. Code:
$pm['attachments'] = array(); |
Quote:
################################################## ################# # Code modifications in file "profile.php" ################################################## ################# ------------------------------------------------------------------- at line 2327, search for this code: ------------------------------------------------------------------- Code:
// Get attachment info change it to: ------------------------------------------------------------------- Code:
$attachments = $DB_site->query(" at line 2360, search for this code: ------------------------------------------------------------------- Code:
$show['inprogress'] = iif(!$post['postid'], true, false); change it to: ------------------------------------------------------------------- Code:
$show['inprogress'] = iif(!$post['postid'] && !$post['private'], true, false); # Template modifications in template "modifyattachmentsbit" ################################################## ################# ------------------------------------------------------------------- search for this: ------------------------------------------------------------------- Code:
<div><strong>$vbphrase[thread]</strong>: <a href="showthread.php?$session[sessionurl]t=$post[p_threadid]">$post[t_title]</a></div> change it to: ------------------------------------------------------------------- Code:
<if condition="$show[privateattachment]"> # New phrases to add ################################################## ################# Add a new phrase and make sure it is in the posting group, otherwise it won't work phrase: in_private_message Text: Private Message With that when you go to the manage attachment section of the usercp instead of saying "In progress" it will show the correct posting date and an indicator that it really was a private message and not a post |
This
Code:
</end if> Code:
</if> Thank you for the fix, by the way. ;) |
The indicator in the usercp almost works. The box for the regular attachments is blank now. Also, is there any way to take the words Thread and Post out of the pm attachments box in the usercp?
|
Quote:
|
Quote:
|
I should have caught that, I'm sorry. ;)
Much better now. Is there a way to maybe grab the pmid and put it in the area right under Private Message (in case we need to track anything soemtime)? |
Quote:
|
I set it up and it caused my PM to stop working. So I un-installed the hack and now this is what I get when I click on my normal attachments. :(
------------------------------------ Database error in vBulletin 3.0.0 Release Candidate 2: Invalid SQL: SELECT filename, filesize, postid, attachment.userid, filedata, dateline, visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted, private FROM vb3_attachment AS attachment LEFT JOIN vb3_attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1)) LEFT JOIN vb3_deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post') WHERE attachmentid = 1 mysql error: Unknown column 'private' in 'field list' mysql error number: 1054 --------------------------------- Any idea to at least fix my attachment table so I can try again? |
Quote:
ALTER TABLE attachment add private int not null; ALTER TABLE pmtext add attach int not null; ALTER TABLE attachment add index (private); You can run any query in the admin control panel, almost at the end in a section called "Execute SQL Query", for you to be able to run any query in the config.php you should have a line like $canrunqueries = '1'; changing that 1 for whatever your userid is, that is. Or, if your host provides you with phpmyadmin then you can run queries from that. Please be aware that depending on the size of your attachment table the first query can take a while. |
I will redo everything. I think I messed up because that was the first file and not the updated version. Will tell you if everything works :)
|
How about who it is from? And the title (if there's room)?
|
Edit: Yay it works now. I think it was the way I was executing the queries. I did them one by one instead of my usual all at once and it worked. Works like a charm :) My post attachments have also started to work fine again. Nice hack *clicks install* :D
thx for the help also |
I wouldn't mind installing this, but only if the attachments are deleted after they download them. I sure don't want my db getting abused like that. :eek:
|
Excellent. I was wondering why it didn't work the first time....I was so intent on not making any mistakes as this was my first sql query update that I forgot to upload the files. Yes, stop laughing at me now.
Works first time. Excellent instructions, for a very useful hack! |
Does this hack follow what you have set for the attchment storage as far as where they are stored? I have mine stored on the disk and not the db.
|
Quote:
This hack uses the same quotas and options that you have already defined for your attachments so if you have a quota for each user no matter if they attach files to posts or private message once they reach their limit they would have to delete some to continue attaching files. |
Quote:
|
All times are GMT. The time now is 07:24 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|