The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[VB3 RC3] Attachments in private messages Details »» | |||||||||||||||||||||||||||
[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 |
#22
|
||||
|
||||
Try sending yourself an attachment and see what that does.
|
#23
|
|||
|
|||
Quote:
I can send you my private.php if you want. |
#24
|
||||
|
||||
Quote:
if ($pm['attach']) { and the "}" at the end, ej. Code:
$pm['attachments'] = array(); $attachments = $DB_site->query(" SELECT filename, filesize, visible, attachmentid, counter, postid, IF(thumbnail = '', 0, 1) AS hasthumbnail, LENGTH(thumbnail) AS thumbnailsize FROM " . TABLE_PREFIX . "attachment WHERE private='".$pm['pmtextid']."' "); while ($attachment = $DB_site->fetch_array($attachments)) { $attachment['kilobytes'] = vb_number_format($attachment['filesize'] / 1024, 1); $pm['attachments']["$attachment[attachmentid]"] = $attachment; } |
#25
|
||||
|
||||
Quote:
################################################## ################# # Code modifications in file "profile.php" ################################################## ################# ------------------------------------------------------------------- at line 2327, search for this code: ------------------------------------------------------------------- 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 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 "); change it to: ------------------------------------------------------------------- Code:
$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 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 . "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 "); 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); $show['privateattachment'] = iif($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> <div><strong>$vbphrase[post]</strong>: <a href="showthread.php?$session[sessionurl]p=$post[postid]#post$post[postid]">$post[p_title]</a></div> </div> change it to: ------------------------------------------------------------------- Code:
<if condition="$show[privateattachment]"> <div><strong>$vbphrase[in_private_message]</strong></div> <else /> <div><strong>$vbphrase[thread]</strong>: <a href="showthread.php?$session[sessionurl]t=$post[p_threadid]">$post[t_title]</a></div> <div><strong>$vbphrase[post]</strong>: <a href="showthread.php?$session[sessionurl]p=$post[postid]#post$post[postid]">$post[p_title]</a></div> </div> </if> # 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 |
#26
|
||||
|
||||
This
Code:
</end if> Code:
</if> Thank you for the fix, by the way. |
#27
|
||||
|
||||
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?
|
#28
|
|||
|
|||
Quote:
|
#29
|
||||
|
||||
Quote:
|
#30
|
||||
|
||||
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)? |
#31
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|