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
This modification may not be copied, reproduced or published elsewhere without author's permission.
I just wanted to add that I'm in the process of upgrading my forum to vB3 Gold [*twitches*], so I'm obviously "hacking" away and I got this one to work perfectly fine. The only bump I ran into was when I got to the one big code modification for the sql query in "profile.php" at that point I just followed the original vb3 code line for line and compared it with the replacement code in the install text file and made the changes that way and it seemed to work for me. I did test by sending to and from a dummy "regular" user account and etc and so far, perfecto - no permission errors and such.
I just wanted to add that I'm in the process of upgrading my forum to vB3 Gold [*twitches*], so I'm obviously "hacking" away and I got this one to work perfectly fine. The only bump I ran into was when I got to the one big code modification for the sql query in "profile.php" at that point I just followed the original vb3 code line for line and compared it with the replacement code in the install text file and made the changes that way and it seemed to work for me. I did test by sending to and from a dummy "regular" user account and etc and so far, perfecto - no permission errors and such.
*clicks install*
Can you post the changes that need to be made for vB3 Gold?
Can you post the changes that need to be made for vB3 Gold?
Sure, but no garauntees, maybe I just got lucky.
This is the vB 3.0.0 Gold original profile.php:
PHP Code:
// Get attachment info
$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, post.dateline AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid " . iif($userid==$bbuserinfo['userid'], ", IF(attachment.postid = 0, 1, 0) AS inprogress") . "
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage ");
And this is what I replaced it with based off of the install .txt [profile.php]:
PHP Code:
// Get attachment info
$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, if(post.postid,post.dateline,pmtext.dateline) AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid, attachment.private, pmtext.title, pm.pmid " . iif($userid==$bbuserinfo['userid'], ", IF(attachment.postid = 0, 1, 0) AS inprogress") . "
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pmtext.pmtextid = attachment.private)
LEFT JOIN " . TABLE_PREFIX . "pm AS pm ON (pmtext.pmtextid=pm.pmtextid AND pm.userid=$userid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage ");
Before anyone goes to my site and points out that it still says RC2 - I cloned my database and am upgrading from a test location. I'm that anal/paranoid. *rolls eyes* I tested on the right version.
// Get attachment info
$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, post.dateline AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid " . iif($userid==$bbuserinfo['userid'], ", IF(attachment.postid = 0, 1, 0) AS inprogress") . "
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage ");
And this is what I replaced it with based off of the install .txt [profile.php]:
PHP Code:
// Get attachment info
$attachments = $DB_site->query("
SELECT thread.forumid, post.postid, post.threadid AS p_threadid, post.title AS p_title, if(post.postid,post.dateline,pmtext.dateline) AS p_dateline, attachment.attachmentid,
thread.title AS t_title, attachment.filename, attachment.counter, attachment.filesize AS size, IF(thumbnail = '', 0, 1) AS hasthumbnail,
user.username, thread.open, attachment.userid, attachment.private, pmtext.title, pm.pmid " . iif($userid==$bbuserinfo['userid'], ", IF(attachment.postid = 0, 1, 0) AS inprogress") . "
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pmtext.pmtextid = attachment.private)
LEFT JOIN " . TABLE_PREFIX . "pm AS pm ON (pmtext.pmtextid=pm.pmtextid AND pm.userid=$userid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (attachment.userid = user.userid)
WHERE attachment.userid = $userid AND ((forumid IN (0$forumids) AND thread.visible = 1 AND post.visible = 1 AND deletionlog.primaryid IS NULL) " . iif($userid==$bbuserinfo['userid'], "OR attachment.postid = 0") . ")
ORDER BY attachment.attachmentid DESC
LIMIT " . ($limitlower - 1) . ", $perpage ");
Before anyone goes to my site and points out that it still says RC2 - I cloned my database and am upgrading from a test location. I'm that anal/paranoid. *rolls eyes* I tested on the right version.
Is that the only change you had to make to get it to work in GOLD? Everything else was right on in the install file, then? ;l)
Is that the only change you had to make to get it to work in GOLD? Everything else was right on in the install file, then? ;l)
Yep. Well, the first edit on the "private.php" page was different but it wasn't complex. The first edit "at line 25..." the gold code is only different because they've added the "rankphp" under "banemail" so I just added "rankphp" to the edits. I figured that a monkey could work that one out so I didn't mention it.
Other than that, I don't remember having any other problems.
Well, not all newbies would understand that, that is why I asked you if you could post all of the changes. Otherwise, you will probably get swamped with "what does this mean" and what do you do here" type questions.
Well, not all newbies would understand that, that is why I asked you if you could post all of the changes. Otherwise, you will probably get swamped with "what does this mean" and what do you do here" type questions.
there is only 1 modification thats diff and i believe its on page 10