PDA

View Full Version : [VB3 RC3] Attachments in private messages


Pages : [1] 2

Kentaurus
01-06-2004, 10:00 PM
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.

Dpcows
01-07-2004, 09:18 AM
Nice one..

Boofo
01-07-2004, 11:34 AM
Thank you. Now I donm't have to mess with it. I was just asking about this today over there. ;)

FleaBag
01-07-2004, 12:23 PM
Great work, will definitely use this.

Boofo
01-07-2004, 02:10 PM
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. ;)

MGM
01-07-2004, 06:30 PM
very nice! I was wondering if anyone would release this for vB3 :p

thanks for the hack!

* MGM clicks Install

MGM out

jluerken
01-08-2004, 11:58 AM
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.

Slynderdale
01-08-2004, 02:58 PM
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.

Boofo
01-08-2004, 03:54 PM
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.
You DO have a fix for this, right? ;)

Kentaurus
01-08-2004, 05:11 PM
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.You are right. Seems hard to believe but I haven't deleted a pm since the beggining... and I have more than 3 years with the forum, that's why I didn't think about the need of purging the unused attachments.

I'll look into it and release a fix for that later today.

Boofo
01-08-2004, 05:13 PM
Does the regular attachments work the same way, or are they doing an unset?

Kentaurus
01-08-2004, 06:14 PM
Does the regular attachments work the same way, or are they doing an unset?
The regular attachments are deleted when the post is deleted or the user deletes the attachment via the usercp, in my hack I forgot to write some code to delete any unused attachment.

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:
-------------------------------------------------------------------



$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:
-------------------------------------------------------------------



$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.")");
}


Also, I forgot to mention earlier, you should add an index to the attachment table for the private column, it really matters for large tables. Here is the query:

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.

Kentaurus
01-08-2004, 06:25 PM
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. ;)
I really prefer them to be tied to the regular attachments, otherwise you need to almost duplicate the quota code for the attachments, it shouldn't be so hard to do but still it's not something I would really be using, it's easier for my users just to have one attachment quota.

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.

Boofo
01-08-2004, 06:36 PM
Thank you, sir. ;)

Convergys
01-08-2004, 06:49 PM
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?

Boofo
01-08-2004, 06:51 PM
I really prefer them to be tied to the regular attachments, otherwise you need to almost duplicate the quota code for the attachments, it shouldn't be so hard to do but still it's not something I would really be using, it's easier for my users just to have one attachment quota.

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.
That makes sense. ;)

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?

Boofo
01-08-2004, 07:03 PM
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. ;)

Convergys
01-08-2004, 07:12 PM
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. ;)
Are you are speaking with me? If so, thanks...
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...

Kentaurus
01-08-2004, 07:19 PM
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?The "In progress" status is a bug, I'll fix it soon. That's because there is no post associated to the attachment.

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.


if ($pm['attach'])
{
$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;
}
}

Also, the attachments in a normal post show fine? The same code that creates the postbit for a thread is the code that creates it for a pm.

Convergys
01-08-2004, 07:28 PM
The "In progress" status is a bug, I'll fix it soon. That's because there is no post associated to the attachment.

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.


if ($pm['attach'])
{
$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;
}
}

Also, the attachments in a normal post show fine? The same code that creates the postbit for a thread is the code that creates it for a pm. Yeah, I have that change in the code... Not sure what is causing the problem...

Attachments in normal post do show fine...

Boofo
01-08-2004, 07:35 PM
Try sending yourself an attachment and see what that does.

Convergys
01-08-2004, 07:37 PM
Try sending yourself an attachment and see what that does. It shows the private message as if the hack was not installed.. IE... there is nothing indicating an attachment was sent...

I can send you my private.php if you want.

Kentaurus
01-08-2004, 07:53 PM
It shows the private message as if the hack was not installed.. IE... there is nothing indicating an attachment was sent...

I can send you my private.php if you want.
Erase this lines:

if ($pm['attach'])
{

and the "}" at the end, ej.


$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;
}


and see if it does the trick. That check is there for some code optimization and normally it isn't a problem.

Kentaurus
01-08-2004, 08:20 PM
I am having problems with this...
When I view trhe attachments i have posted in the user cp, it shows, In Progress... Have i dont something wrong?That is yet another modification to make. The txt is already updated but if you downloaded it before this post you might not have this changes:

################################################## #################
# Code modifications in file "profile.php"
################################################## #################
-------------------------------------------------------------------
at line 2327, search for this 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:
-------------------------------------------------------------------

$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:
-------------------------------------------------------------------

$show['inprogress'] = iif(!$post['postid'], true, false);

------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

$show['inprogress'] = iif(!$post['postid'] && !$post['private'], true, false);
$show['privateattachment'] = iif($post['private'], true, false);


################################################## #################
# Template modifications in template "modifyattachmentsbit"
################################################## #################
-------------------------------------------------------------------
search for this:
-------------------------------------------------------------------


<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:
-------------------------------------------------------------------


<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

Boofo
01-08-2004, 08:35 PM
This

</end if>

should be

</if>

or I get an error when I try to save the template. ;)

Thank you for the fix, by the way. ;)

Boofo
01-08-2004, 08:40 PM
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?

Convergys
01-08-2004, 08:42 PM
Erase this lines:

if ($pm['attach'])
{

and the "}" at the end, ej.


$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;
}


and see if it does the trick. That check is there for some code optimization and normally it isn't a problem.
still not working.

Kentaurus
01-08-2004, 08:43 PM
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?
Yes, there is one more glitch I forgot to edit, in the template edit <else> should be <else />, otherwise Thread and Post are still shown. I don't know how that code managed to go through the instructions. (well, I do know...)

Boofo
01-08-2004, 08:58 PM
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)?

Kentaurus
01-08-2004, 09:11 PM
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)?Yes, you have to do a left join of the pm table to get the pmid, I didn't code it because I don't like mysql doing extra work and that query had a lot of joins already, but it should be easy to do, a left join of the pm table using the pmtextid as the foreign key and checking that the message belongs to the user. That may be useful, I'll see what else is missing and add that to the hack.

hagi
01-08-2004, 10:28 PM
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?

Kentaurus
01-09-2004, 12:25 AM
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?
Did you run the queries almost at the end of the file. You are trying to select a "private" column, but your database doesn't have one, until you add the columns there would be some database errors. These are the queries:

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.

hagi
01-09-2004, 12:29 AM
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 :)

Boofo
01-09-2004, 12:32 AM
How about who it is from? And the title (if there's room)?

hagi
01-09-2004, 01:03 AM
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

SloppyGoat
01-09-2004, 09:42 PM
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:

Nmidia
01-09-2004, 11:06 PM
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!

Boofo
01-10-2004, 02:29 AM
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.

Kentaurus
01-10-2004, 08:35 AM
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:
Wouldn't that be a little hard on your users? I usually download an attachment more than once, and after I download it I expect it to remain there. That would seem a little un(user-friendly) to me.

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.

Kentaurus
01-10-2004, 08:37 AM
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.
It should. It uses the same code that normal posts use for attachments, I just moved that feature to private messages. I tested both the file and db storage and they seemed to be working.

Erwin
01-10-2004, 08:38 AM
Very good idea, and well done. :) Should be standard in vB3 if you ask me. ;)

Boofo
01-10-2004, 09:27 AM
kentaurus, did you chnage anything in the hack yesterday? OI noticed your firest post was updated with Hack Update.

Kentaurus
01-10-2004, 02:38 PM
kentaurus, did you chnage anything in the hack yesterday? OI noticed your firest post was updated with Hack Update.
It's still the same hack, only I edited the edit reason because some people downloaded the old attachment. The only two updates I have done are the ones that are also commented in the forum, the delete the file when the attachment is deleted and the fix for the view attachments in cp.

Boofo
01-11-2004, 08:59 PM
kentaurus, found a major problem with this hack. When I reply to a message (haven't checked the forwarding out yet), it sends the attachments I have stored along with the message. On a new message, it works fine. Only on replies so far (or forwards, I haven't checked yet).

Boofo
01-12-2004, 02:32 PM
Ok, I've narrowed it down a bit further. It seems the attachments get added to any message that is sent out with the Quick PM Reply hack. The regular reply works fine. Any way to fix this?

Kentaurus
01-13-2004, 02:19 AM
Ok, I've narrowed it down a bit further. It seems the attachments get added to any message that is sent out with the Quick PM Reply hack. The regular reply works fine. Any way to fix this?
Is that a problem of the Quick PM reply hack or mine? In my forum it works well.
I'll install the Quick PM reply and see where to fix it.

Boofo
01-13-2004, 02:22 AM
Thank you, sir. ;)

I told Erwin about it but he said he couldn't fix problems with other people's hacks. :tired:

Kentaurus
01-13-2004, 02:57 AM
Thank you, sir. ;)

I told Erwin about it but he said he couldn't fix problems with other people's hacks. :tired:
I could also say that I can't fix problems with other people's hacks ;)

Boofo
01-13-2004, 03:06 AM
If I had to make a choice, yours will stay. ;)

Kentaurus
01-13-2004, 03:40 AM
If I had to make a choice, yours will stay. ;)
Well.. jokes away, this is something bad. If you have both hacks installed and use quick reply it would cause all attachments, not only the ones in that private message to belong to the new pm. That is a really really bad thing.

I was relying on the posthash for the attachments, the quick reply has no posthash (an empty one) so the code just assumes that all attachments with an empty posthash are for that message (ie - all other attachments in the forum).

I made a patch so this hack will work cooperative with the quick reply, I'll pm Erwin and see if he wants to update his hack also, either hack can be patched but I can only modify mine of course.

find this:

$attachcount = $DB_site->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '" . addslashes($_POST['posthash']) . "'
AND userid = $bbuserinfo[userid]
");
$totalattachments = $attachcount['count'];

if ($totalattachments)
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "pmtext SET attach='$totalattachments' WHERE pmtextid='$pmtextid'");
$DB_site->query("
UPDATE " . TABLE_PREFIX . "attachment
SET private = $pmtextid, posthash = ''
WHERE posthash = '" . addslashes($_POST['posthash']) . "' AND
userid = $bbuserinfo[userid]
");
}

replace it with this:


if ($_POST['posthash']) {
$attachcount = $DB_site->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '" . addslashes($_POST['posthash']) . "' AND posthash<>''
AND userid = $bbuserinfo[userid]
");
$totalattachments = $attachcount['count'];

if ($totalattachments)
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "pmtext SET attach='$totalattachments' WHERE pmtextid='$pmtextid'");
$DB_site->query("
UPDATE " . TABLE_PREFIX . "attachment
SET private = $pmtextid, posthash = ''
WHERE posthash = '" . addslashes($_POST['posthash']) . "' AND
userid = $bbuserinfo[userid]
");
}
}



TXT is updated also

Boofo
01-13-2004, 03:57 AM
Will this hurt anything for anyone who doesn't have Erwin's hack installed? Or is this ONLY to be used if you are using his hack, too?

Kentaurus
01-13-2004, 04:01 AM
Will this hurt anything for anyone who doesn't have Erwin's hack installed? Or is this ONLY to be used if you are using his hack, too?Either if you have Erwin's hack installed or not it won't hurt. It's just an additional security check. I would recommend installing it though.

In the txt this code is included for the people that install the hack for their first time to ensure that they don't have any problems if they install the quick reply after.

Boofo
01-13-2004, 04:06 AM
Thank you very much, sir, for the fast fix. ;)

I'm looking forward to more of your great hacks in the future. You seem to care about fixing things to work with and around other's hacks, when it is a lot easier to pass the buck, sometimes. ;)

Boofo
01-13-2004, 04:52 AM
I hate to be the bearer of bad news, but there is a small problem now. Oh, it works great with Erwin's hack now but all of my attachments are showing as Private Message even when they aren't. ;)

Kentaurus
01-13-2004, 01:50 PM
I hate to be the bearer of bad news, but there is a small problem now. Oh, it works great with Erwin's hack now but all of my attachments are showing as Private Message even when they aren't. ;)I'm afraid that is because when you sent a private message all the forum attachments were marked to belong to that new private message.

That is why I told before that it was really bad, because without the fix as soon as you used quick reply all the attachments in the forum would go to the private message.

Right now there is no easy way to fix this, since the damage is already done... I wish I had seen that coming before. However, you can run a query to recover all the attachments in posts, this will return them to think they belong to a post and not to a private message, the only ones that can't be recovered are the ones in the private message, they already belong to the last pm that was sent.

Ok, this is the scenario:
attachment1 - in private message
attachment2 - in private message
attachment3 - in private message
attachment4 - in private message

after running the query
attachment1 - in post xxx
attachment2 - in post yyy
attachment3 - in private message
attachment4 - in post zzz

the attachment 3 remains in a private message, but potentially not the one that it should but the last one sent via pm quick reply. The next time you use attachments in private message there will be no problem, it's just that the quick reply messed up the attachments that weren't expecting a hashless post to come along.

Query:
update attachment set private=0 where postid<>0

Boofo
01-13-2004, 07:47 PM
Thanks for the query. All seems well again. ;)

Is there any way to add a From: and Sent to: the listing of attachments under the Private Message part? It might be nice to know at a quick glance who the attachment was sent to or came from. ;)

Kentaurus
01-17-2004, 10:34 PM
I have a small change (template edit). It is completely optional.

This will add a paperclip to the left of the title of the private message if the private message contains an attachment.

In pm_messagelistbit

find this:

<a href="private.php?$session[sessionurl]do=showpm&amp;pmid=$pm[pmid]"><if condition="$show['unread']"><strong>$pm[title]</strong><else />$pm[title]</if></a>

add before:

<if condition="$pm['attach']"><img class="inlineimg" src="$stylevar[imgdir_misc]/paperclip.gif" alt="<phrase 1="$pm[attach]">$vbphrase[x_attachments]</phrase>" /></if>



Next I will do is that From and Title for the attachments' screen.

Kentaurus
01-17-2004, 11:33 PM
Only for the people that already have it installed.

This will add a link to the private message sent in the attachments screen so you can go and read to message or at least know which private message it was.

Find this query in profile.php


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

change it to:


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

and in the modifyattachmentsbit template

change
<div><strong>$vbphrase[in_private_message]</strong></div>

to this
<div><strong>$vbphrase[in_private_message]:</strong> <a href="private.php?do=showpm&pmid=$post[pmid]">$post[title]</a></div>

I'll leave the from and sent-to, that's because a private message can be sent to multiple members. And deciding who the attachment belongs to can be real tricky.. right now it only appears to the person that sent the private message.

Boofo
01-18-2004, 03:29 AM
Ok, that works but it now shows each pm attachment twice in the attachments list. ;)

Have the instructions from the first post been updated with this and the paperclip code?

SloppyGoat
01-18-2004, 09:29 PM
Wouldn't that be a little hard on your users? I usually download an attachment more than once, and after I download it I expect it to remain there. That would seem a little un(user-friendly) to me.

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.How would that be hard on users? I could see your point if more than one person was dnlding the attachment, but there will always only be one person viewing the PM, right? Once they have the file, I see no reason to let them store the attachments indefinitely. The only way this could be bad, is if a dnld failed, I guess. But I've yet to see that happen.

SloppyGoat
01-18-2004, 09:34 PM
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.A bit off topic, but can you tell me how you do that? I'd rather have my files stored on disk too! I prefer to keep the db as small as possible.

Kentaurus
01-18-2004, 10:04 PM
A bit off topic, but can you tell me how you do that? I'd rather have my files stored on disk too! I prefer to keep the db as small as possible.
In the admin control panel, in the menu go to attachments -> attachment storage type. there you can switch between database and disk.

The only way this could be bad, is if a dnld failed, I guess. But I've yet to see that happen.
Downloads fail for me all the time.. maybe it is just my isp. Also, I am likely to forget where in my hd (or in which computer) I stored the file, I might end searching in the pm so I can dl it again.

SloppyGoat
01-19-2004, 12:31 AM
In the admin control panel, in the menu go to attachments -> attachment storage type. there you can switch between database and disk.Oh! I saw the one for avatars, and I was thinking of that. Now that I look, I've already transfered all my attachments too. DOH! I'm going to have to stop thinking in vB2.X terms, eh? :rolleyes:

Downloads fail for me all the time.. maybe it is just my isp. Also, I am likely to forget where in my hd (or in which computer) I stored the file, I might end searching in the pm so I can dl it again.I only allow 150K attachments, so that's not usually an issue(that I've heard of), on my server anyway. I don't mind this at all, as long as the attachments can be stored on the HDD. :up:

Have all the changes discussed in this thread been updated in the original txt now, or do I need to go back and read all of this again? Nice hack! I'm liking this more and more now...the more I read about it. :up:

Kentaurus
01-19-2004, 08:27 AM
Oh! I saw the one for avatars, and I was thinking of that. Now that I look, I've already transfered all my attachments too. DOH! I'm going to have to stop thinking in vB2.X terms, eh? :rolleyes:

I only allow 150K attachments, so that's not usually an issue(that I've heard of), on my server anyway. I don't mind this at all, as long as the attachments can be stored on the HDD. :up:

Have all the changes discussed in this thread been updated in the original txt now, or do I need to go back and read all of this again? Nice hack! I'm liking this more and more now...the more I read about it. :up:
All changes are applied to the txt, I only write them in the forum for the people that already had the hack installed and don't want to go all over the instructions again.

SloppyGoat
01-19-2004, 08:46 AM
Great! Thanks! I'll be installing this one soon then. ;)

Boofo
01-21-2004, 03:07 AM
Ok, that works but it now shows each pm attachment twice in the attachments list. ;)

Have the instructions from the first post been updated with this and the paperclip code?
I've narrowed this down to if you send yourself a message with attachments in it, it shows them twice on the Attachments listing. What do I need to do to stop this? ;)

Boofo
01-22-2004, 01:12 AM
When you click on the "Show Thumbnails" link, it doesn't show the thumbnails for private attachments. Is there a fix for this, also? ;)

thuffner
01-22-2004, 05:17 AM
Just installed vB3 RC3 and re-did this hack twice with no avail.

Doesn't seem to work on RC3... :(:(

Boofo
01-22-2004, 05:18 AM
Works great on my RC3. You must have missed something somewhere. ;)

thuffner
01-22-2004, 05:27 AM
Well everything works fine except the attachment doesnt show up in a PM...

thuffner
01-22-2004, 05:43 AM
Just installed again and it didn't work.

It attaches to a PM fine. I send it to myself, open the PM, and no attachment is in the PM...

Boofo
01-23-2004, 10:15 AM
kentaurus, are you still supporting this hack? ;)

Kentaurus
01-23-2004, 02:18 PM
kentaurus, are you still supporting this hack? ;)not at the same pace, but yes, I am :) If a really big bad bug appears I would of course give priority to it, for small modifications I usually delay a little more. I even tested this with RC3 yesterday and checked if the instructions were still ok.

About that double attachment in the attachment screen I am still thinking if I should fix that. The attachments in private message are somehow more controversial than the common attachments...

Right now I can duplicate the attachment for the attachment owner and all the members for which the attachment is sent.. that takes a lot of space in little time because a single attachment can be stored twice, or three times, or more. If I don't do that ownership of the attachment is difficult to determine.

If the owner of the attachment is the one that sent the attachment then I can go to attachments -> delete this attachment and the person that received it keeps nothing. I don't think this is natural, right now if someone sends me something by mail there is no way they can delete it after being sent.

If the owner of the attachment is the recipient then I have to do that store-attachments-more-than-once, and that's not nice for the db or the filesystem. I can't store it only once because a pm can be sent to multiple recipients, and then any recipient would be able to delete it leaving the rest with no attachment. This is even worse than the owner deleting it.

And now, why does the attachment appears twice in the attachment screen? That is because it appears once for each of your pm with that attachments, and if you send the pm to yourself and also you keep a copy then you have 2 pm's. Then that screen will link once to the pm you recieved from yourself and once to the pm that is in the sent folder.. even if it's the same attachment. That is why I haven't fixed it yet.. I am still debating if I should. Sending a pm to yourself is not that natural anyway, unless I were using the pm as a personal notepad or something.

Kentaurus
01-23-2004, 02:21 PM
Just installed again and it didn't work.

It attaches to a PM fine. I send it to myself, open the PM, and no attachment is in the PM...
There was also someone having that problem before. Do you have any other hack installed that deals with functions_posting.php or private.php?

Also, did you made all the code modifications in private.php? That's usually the problem.

sonic3d
01-23-2004, 08:09 PM
nice job

thuffner
01-23-2004, 11:16 PM
There was also someone having that problem before. Do you have any other hack installed that deals with functions_posting.php or private.php?

Also, did you made all the code modifications in private.php? That's usually the problem.
Nope no other hacks installed. And did the private.php mods. I switched over to thumbnail attached images in my ACP and it works fine now. A workaround, but I'll take it. :)

Boofo
01-24-2004, 03:07 AM
not at the same pace, but yes, I am :) If a really big bad bug appears I would of course give priority to it, for small modifications I usually delay a little more. I even tested this with RC3 yesterday and checked if the instructions were still ok.

About that double attachment in the attachment screen I am still thinking if I should fix that. The attachments in private message are somehow more controversial than the common attachments...

Right now I can duplicate the attachment for the attachment owner and all the members for which the attachment is sent.. that takes a lot of space in little time because a single attachment can be stored twice, or three times, or more. If I don't do that ownership of the attachment is difficult to determine.

If the owner of the attachment is the one that sent the attachment then I can go to attachments -> delete this attachment and the person that received it keeps nothing. I don't think this is natural, right now if someone sends me something by mail there is no way they can delete it after being sent.

If the owner of the attachment is the recipient then I have to do that store-attachments-more-than-once, and that's not nice for the db or the filesystem. I can't store it only once because a pm can be sent to multiple recipients, and then any recipient would be able to delete it leaving the rest with no attachment. This is even worse than the owner deleting it.

And now, why does the attachment appears twice in the attachment screen? That is because it appears once for each of your pm with that attachments, and if you send the pm to yourself and also you keep a copy then you have 2 pm's. Then that screen will link once to the pm you recieved from yourself and once to the pm that is in the sent folder.. even if it's the same attachment. That is why I haven't fixed it yet.. I am still debating if I should. Sending a pm to yourself is not that natural anyway, unless I were using the pm as a personal notepad or something.That makes more sense now. I usually don't send pms with attachmnets to myself, so that is not any problem having it show up twice. It was just a test message that I have already erased anyway. ;)

What about the Show Thumbnails not working with pm attachments? Can that be fixed?

Kentaurus
01-25-2004, 02:46 AM
What about the Show Thumbnails not working with pm attachments? Can that be fixed?
Of course, of course :nervous:

In profile.php search for this:

$show['thumbnail'] = iif($post['hasthumbnail'] == 1 AND $vboptions['attachthumbs'] AND $showthumbs AND $post['postid'], 1, 0);

replace it with:

$show['thumbnail'] = iif($post['hasthumbnail'] == 1 AND $vboptions['attachthumbs'] AND $showthumbs AND ($post['postid'] OR $post['private']), 1, 0);

Boofo
01-25-2004, 03:04 AM
Thank you, sir. ;) Will you be updating the file in the first post with this?

Kentaurus
01-25-2004, 03:35 AM
Thank you, sir. ;) Will you be updating the file in the first post with this?
Already updated.

gmarik
01-26-2004, 05:57 AM
I like to like it ;)

Giveit2u43
01-28-2004, 08:30 PM
I had a similiar problem with everything seeming to work fine but the attachments not actually showing in the pm's.. I finally tracked it down to the fact the forum had been upgraded from vb2, and we`d had the private attachments hack installed and so there was already a "private" table in attachments, I`d overlooked this on installation, but on removing that table and creating a new one fixed the problem with attachments not showing...

Might not work for others, but it worked for us and it gives people another option to try when attempting to get this great addon working... (haveto agree with Erwin too, this should be standard in gold! definetly get's my vote)

Natch
01-28-2004, 09:19 PM
Great job!

Thanks for this excellent tool ...

/me installs *

Boofo
02-02-2004, 09:29 AM
Found another boo-boo with this. If you add an attachment to a pm and then preview the pm, the attachment has detatched itself. Then, without saving the message, view your attachments and you will see the attachment in the listing.

catocom2
02-04-2004, 08:02 PM
I installed this, and everything looks fine so far, except it keeps
telling me I don't have permission to do an attachment.

I'm not clear as to what is meant here...
################################################## #################
# 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


Do I do this in a PM?

catocom2
02-04-2004, 08:17 PM
oh, and I'm running RC3
I couldn't fine this bit of code in the "pm_newpm"
-------------------------------------------------------------------
search for this:
-------------------------------------------------------------------

<input type="hidden" name="receipt" value="0" />

------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

<input type="hidden" name="receipt" value="0" />
<input type="hidden" name="posthash" value="$posthash" />


I also have the hack so that the reciept box is a checkbox instead of a popup.

catocom2
02-04-2004, 08:37 PM
OK with the checkbox mod the line look like this in the "pm_newpm"

in stead of ...-------------------------------------------------------------------
search for this:
-------------------------------------------------------------------

<input type="hidden" name="receipt" value="0" />

------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

<input type="hidden" name="receipt" value="0" />
<input type="hidden" name="posthash" value="$posthash" />



look for....
<input type="checkbox" name="receipt" id="cb_receipt" value="1" checked />
Request Read Receipt?

and change to...
<input type="checkbox" name="receipt" id="cb_receipt" value="1" checked />
Request Read Receipt?
<input type="hidden" name="posthash" value="$posthash" />


right?

Kentaurus
02-05-2004, 01:39 AM
OK with the checkbox mod the line look like this in the "pm_newpm"

in stead of ...

look for....
<input type="checkbox" name="receipt" id="cb_receipt" value="1" checked />
Request Read Receipt?

and change to...
<input type="checkbox" name="receipt" id="cb_receipt" value="1" checked />
Request Read Receipt?
<input type="hidden" name="posthash" value="$posthash" />


right?
Yes, that's right. In fact you can add that bit of code anywhere inside the form tag... it doesn't have to be near the receipt or anything. I just added it there to group it with all the other hidden fields.

Kentaurus
02-05-2004, 01:40 AM
I installed this, and everything looks fine so far, except it keeps
telling me I don't have permission to do an attachment.

I'm not clear as to what is meant here...


Do I do this in a PM?
The new phrases are added in the admin control panel, that is, you go to the phrase manager and click on the "add new phrase" button

Kentaurus
02-05-2004, 02:07 AM
Found another boo-boo with this. If you add an attachment to a pm and then preview the pm, the attachment has detatched itself. Then, without saving the message, view your attachments and you will see the attachment in the listing.A couple of changes to fix this. Thanks for spotting this, Boofo.

In private.php search for this
$poststarttime = TIMENOW;
change it to
if ($_POST['poststarttime'])
{
$poststarttime = $_POST['poststarttime'];
}
else
{
$poststarttime = TIMENOW;
}

In the template pm_newpm, search for this

<input type="hidden" name="posthash" value="$posthash" />
change it to
<input type="hidden" name="posthash" value="$posthash" />
<input type="hidden" name="poststarttime" value="$poststarttime" />

TXT updated also

catocom2
02-05-2004, 02:42 PM
The new phrases are added in the admin control panel, that is, you go to the phrase manager and click on the "add new phrase" button

I found where to add the phrases there.
It still says I don't have permission when I open the attachment window though. :surprised:

Kentaurus
02-05-2004, 06:43 PM
I found where to add the phrases there.
It still says I don't have permission when I open the attachment window though. :surprised:
Did you do the template modifications in the newattachment template? That would be a cause for the window to give you a nopermission error.

If you have the hack installed in an accesible board for me to take a quick peek that would help also.

catocom2
02-06-2004, 12:01 AM
Thanks Kentaurus!
It was in the "newattachment.php" file.
I must have missed something in that file the first time around.
I took a fresh copy, and tried it again. It works perfectly now. :up:

catocom2
02-06-2004, 12:10 AM
Is there a way to moderate PM attachments in the admincp, like
the regular attachments?

Kentaurus
02-06-2004, 12:43 AM
Is there a way to moderate PM attachments in the admincp, like
the regular attachments?
The attachments follow the same rules as the regular attachments, they count for the quota of the user, and you can search for them in the admincp by author, date or any other field.

As for having a moderator queue for attachments that's not a feature. In fact, you do not moderate user's private messages and neither the attachments.

catocom2
02-06-2004, 02:31 AM
ah, I see

catocom2
02-06-2004, 10:48 PM
Well I upgraded to RC4 and reinstalled this hack, but
it has put it at the top for some reason..
It still works good though.:D

Kentaurus
02-06-2004, 10:51 PM
Well I upgraded to RC4 and reinstalled this hack, but
it has put it at the top for some reason..
It still works good though.:DHow is your pm_newpm template? You can add $attachmentoption wherever you want that box to show. Seems to me that it is above the message area. I wil re-check it as soon as I have rc4 installed.

catocom2
02-06-2004, 11:22 PM
ah, yeah I had to move it down in the pm_newpm temp.

find
$disablesmiliesoption
and put it right below it...like..
$disablesmiliesoption
$attachmentoption


I also had a problem with the "private.php" file and had to
change a few things.

Oblivion Knight
02-08-2004, 02:11 PM
All seems to be working well.. :)
Just a small thing of concern, in the message itself where the attached images are shown, the "Attached Images" in the message isn't framed like your screenshot demonstrates..

I've attached a screenshot of this, hopefully you can shed some light on this.?

Boofo
02-08-2004, 04:27 PM
I think I found another bug. I had a member send me a photo of something. I still have the message and there is a paperclip showing there is an attachment to it but when you open the message, there is no attachment there. Now, this member erased all of her sent messages in the pm area. Could that have something to do with this since she is the one who sent it? Cause the attachment she sent me never showed up in my attachment list, only hers.

Revpolar
02-08-2004, 04:32 PM
Yes that'll do it. I just did the install and found that out right away. Which is a good feature if you ask me. Great hack. My install was flawless on RC4. Thanks alot.

Boofo
02-08-2004, 04:37 PM
It's not a good feature if you want to hold on to an attachment like I wanted to. ;)

Kentaurus
02-08-2004, 07:08 PM
All seems to be working well.. :)
Just a small thing of concern, in the message itself where the attached images are shown, the "Attached Images" in the message isn't framed like your screenshot demonstrates..

I've attached a screenshot of this, hopefully you can shed some light on this.?
That's a template thing, if the normal attachments appear framed then the attachments in private message should, too. Try attaching a jpg instead or a gif to see if it changes. How does it show in a normal postbit?

Kentaurus
02-08-2004, 07:10 PM
I think I found another bug. I had a member send me a photo of something. I still have the message and there is a paperclip showing there is an attachment to it but when you open the message, there is no attachment there. Now, this member erased all of her sent messages in the pm area. Could that have something to do with this since she is the one who sent it? Cause the attachment she sent me never showed up in my attachment list, only hers.
That's because the ownership of the attachment is mantained to the person who sent it. He can delete it anytime and you wouldn't have the attachment anymore. I can't give the ownership of the attachment to the recipient because there could be multiple recipients and I wouldn't know who should be the owner. And making a copy for everyone and storing an attachment 3-4 times doesn't seem to me as a good solution.

But the paperclip still showing up is a bug, I'll look into it. That should dissapear as soon as there are no more attachments.

Boofo
02-08-2004, 07:33 PM
Then how can we save an attachment for later without having to download it? Is there anyway to set it up so if someone does decide to delete their attachment, then and only then it would transfer ownership to whoever still has the message that was sent to them with the attachment? On bigger sites, I can see what you're saying might make sense as to not fill up the site with attachments. But on a small site, like mine, there is no worry there yet. Besides, the Admin can see and delete any attachments in the Admin CP if it looks like it is starting to get out of hand.

Oblivion Knight
02-08-2004, 11:27 PM
That's a template thing, if the normal attachments appear framed then the attachments in private message should, too. Try attaching a jpg instead or a gif to see if it changes. How does it show in a normal postbit?Aha.! Correct..
This is a problem with the .gif extension for some reason (on normal posts too)..

Hmm.. *scratches head*


[EDIT]
Hmm.. Just noticed vB.org has this very same problem.
https://vborg.vbsupport.ru/showthread.php?p=474586#post474586

[EDIT 2]
Ok, this is due to image sizes.. My bad.. :o

Boofo
02-08-2004, 11:45 PM
That gif in the link has the box around it ok. What are you seeing?

EDIT: What sizes are we talking about?

Oblivion Knight
02-08-2004, 11:48 PM
EDIT: What sizes are we talking about?
The maximum pixel size w/h an image can be before it is shown as "thumbnail" form.. :)

Concluding that this is default behaviour and not a bug with the mod..
Awesome work Kentaurus.. :D

Boofo
02-08-2004, 11:56 PM
LOL I know WHAT it is, I was curious about what actual size file is messing it up.

Oblivion Knight
02-08-2004, 11:58 PM
Ahh sorry.. It IS 2am here afterall.. ;)
Anything below the default w AND h of 100 pixels here at vB.org..

NuclioN
02-09-2004, 11:10 AM
Looks great but..

* PM attachment is showing up on the forumindex trough this mod: https://vborg.vbsupport.ru/showthread.php?t=61244

* javascript error sendmail: (see attachment)

* Kan not see the send attachment in PM

Kentaurus
02-13-2004, 02:22 PM
Looks great but..

* PM attachment is showing up on the forumindex trough this mod: https://vborg.vbsupport.ru/showthread.php?t=61244

* javascript error sendmail: (see attachment)

* Kan not see the send attachment in PMNote... if the author updates his hack this would need to be updated also.

In Mindtrix hack, look for:


$trix = $DB_site->query("SELECT attachmentid, dateline, filename FROM attachment WHERE dateline < " . TIME() ." ORDER BY dateline DESC LIMIT 5");

change it to:

$trix = $DB_site->query("SELECT attachmentid, dateline, filename FROM attachment WHERE dateline < " . TIME() ." AND private=0 ORDER BY dateline DESC LIMIT 5");

sendmail has nothing to do with this hack, what error are you getting?

Some people reported me before that the attachments weren't showing in the pm, I haven't traced why yet but someone also said that enabling thumbnails in the acp made them visible (I still haven't been able to reproduce it).

MindTrix
02-14-2004, 12:19 PM
Wand me to update my hack with your fix, so it does not clash with your hack mate?

Kentaurus
02-14-2004, 10:23 PM
Wand me to update my hack with your fix, so it does not clash with your hack mate?Thanks Mindtrix, that would be nice. Only that you would need to put it as a note because normally they don't have a "private" column in the table.

MindTrix
02-14-2004, 10:33 PM
Sure ill just make a link then in my post saying about it etc

The Quibbler
02-16-2004, 02:44 PM
/me installs, and hopes it all works fine in RC4.

Boofo
02-29-2004, 05:53 PM
Another small bug. ;)

When you preview a message, the attachment is still there but it doesn't show in the attachments box until you open it up and do a blank upload. Then it lists like it should. Can I get my "fix" for this? ;)

Kentaurus
02-29-2004, 06:00 PM
Another small bug. ;)

When you preview a message, the attachment is still there but it doesn't show in the attachments box until you open it up and do a blank upload. Then it lists like it should. Can I get my "fix" for this? ;)I would need more details for this one. When I send a PM, preview it, if I click in the manage attachments button then the pop-up already has the previously attached file. Or do you mean in the pm original window and not the pop-up?

Boofo
02-29-2004, 06:10 PM
I would need more detailes for this one. When I send a PM, preview it, if I click in the manage attachments button then the pop-up already has the previously attached file. Or do you mean in the pm original window and not the pop-up?
Ok, I guess I got it a little confused. I mean right above the Manage Attchaments button in the Additional options box underneath the message. It won't show the attachment in a preview until you open up the manage attachments box and close it.

Boofo
02-29-2004, 10:35 PM
Shouldn't the attachment show above that button without having to click the manage attachments button to see it?

Kentaurus
02-29-2004, 11:04 PM
It should. That way it is very similar to the normal preview way of doing it. Here is the fix.

find this:


'newpost_attachment'
);


replace it with:

'newpost_attachment',
'newpost_attachmentbit'
);


find this:


eval('$attachmentoption = "' . fetch_template('newpost_attachment') . '";');


replace it with:


$currentattaches = $DB_site->query("
SELECT filename, filesize, attachmentid
FROM " . TABLE_PREFIX . "attachment
WHERE posthash = '$posthash'
AND userid = $bbuserinfo[userid]
");


$attachcount = 0;
while ($attach = $DB_site->fetch_array($currentattaches))
{
$attachcount++;
$attach['extension'] = strtolower(file_extension($attach['filename']));
$attach['filename'] = htmlspecialchars_uni($attach['filename']);
$attach['filesize'] = vb_number_format($attach['filesize'], 1, true);
$show['attachmentlist'] = true;
eval('$attachments .= "' . fetch_template('newpost_attachmentbit') . '";');
}



eval('$attachmentoption = "' . fetch_template('newpost_attachment') . '";');

Boofo
02-29-2004, 11:14 PM
Works great! Thanks! ;)

Is the first post updated?

How would we add the attachments ability to Erwin's Quick Peply hack? ;)

Kentaurus
02-29-2004, 11:48 PM
Works great! Thanks! ;)

Is the first post updated?

How would we add the attachments ability to Erwin's Quick Peply hack? ;)
I am still wondering if Erwin's is a quick pm.... he has all the pm reply screen there! :) Actually in my forum I edited it to only show the textarea and the submit button....

It should be possible to add them, I'll take a look at it.

Boofo
03-01-2004, 05:22 AM
Can you pm me with your edits for the textarea and submit button? ;)

portion
03-01-2004, 12:20 PM
Can you allow only certain usergroups to use this function?

Kentaurus
03-01-2004, 12:24 PM
Can you allow only certain usergroups to use this function?
That would need further hacking.. and right now I have no use for it.

Anyway, what is this obsession with everything being usergroup based lately? (Second hack I get asked) With around 10 usergroups in my forum it is becoming a nightmare for me checking that every option is right....

portion
03-01-2004, 12:56 PM
Can you just point me to the right area, and I can do the editing? I am pretty comfortable with PHP.

DivisionByZero
03-01-2004, 08:22 PM
Wouldn't that be a little hard on your users? I usually download an attachment more than once, and after I download it I expect it to remain there. That would seem a little un(user-friendly) to me.

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.
How about automatically deleting the attachment(s) when the recipient actually DELETES the PM? That seems logical, since you wouldn't want orphaned attachments hogging your quota. That would be a waste of space and DB optimization.

I've installed the hack on 3/1/04 and everything seems to be working fine, except some little bug, where I'll describe in a new post!

DivisionByZero
03-01-2004, 08:24 PM
Now, my problem with the hack is that the recipient clicks the attachment link, and gets an error message of: "No Post Defined". HELP

Kentaurus
03-02-2004, 10:34 AM
How about automatically deleting the attachment(s) when the recipient actually DELETES the PM? That seems logical, since you wouldn't want orphaned attachments hogging your quota. That would be a waste of space and DB optimization.

I've installed the hack on 3/1/04 and everything seems to be working fine, except some little bug, where I'll describe in a new post!
The attachment is automatically deleted when it belongs to no more recipients. There are no orphaned attachments. They are done with the hourly cleanup and that was the reason to modify one of the cron jobs.

Please keep in mind that if you save a copy in your sent folder that counts as a pm, so the attachment wouldn't be deleted until both the recipient's pm and your copy of the pm are deleted.

It is the first time I have seen that "No post defined" error... do you have any other hack that deals with pm's or attachments installed?

DivisionByZero
03-02-2004, 10:51 AM
No, I do not. Your hack is the only one I've installed at all. I went back and double checked everything. However, when I get down to the SQL, I did have problems running those. I ran each individually and it did create the three tables. Though the ALTER TABLE attachment add index (private) query gave me problems though, but I eventually did create the table manually.

DivisionByZero
03-04-2004, 11:08 PM
ok, BIG problem...... I just found out that someone can easily go to your attachment.php page in the browser and just browse through attachments! they can do this by:

attachment.php?attachmentid=1
attachment.php?attachmentid=2
attachment.php?attachmentid=3

Is there a way you can re-release this hack and change the way vBulletin handles attachments? I would suggest md5summing the attachment upon upload and assigning the checksum as the attachment ID. I certainly don't want someone browsing through my members' private attachments!!! :)

Kentaurus
03-06-2004, 09:02 PM
ok, BIG problem...... I just found out that someone can easily go to your attachment.php page in the browser and just browse through attachments! they can do this by:

attachment.php?attachmentid=1
attachment.php?attachmentid=2
attachment.php?attachmentid=3

Is there a way you can re-release this hack and change the way vBulletin handles attachments? I would suggest md5summing the attachment upon upload and assigning the checksum as the attachment ID. I certainly don't want someone browsing through my members' private attachments!!! :)
There is already functionality for this. Another member cannot see an attachment that he doesn't own. They get a permission denied screen. Even if they start browsing the attachments. If the attachment is private sender and recipients are the only ones allowed to see it.

Boofo
03-07-2004, 09:25 PM
Can you update the first post with all of the changes up until now, please? ;)

Kentaurus
03-07-2004, 10:29 PM
Can you update the first post with all of the changes up until now, please? ;)
Updated :)

Boofo
03-07-2004, 10:54 PM
Thank you kindly, sir. ;)

msimplay
03-18-2004, 08:07 AM
can private attachments be done by user groups for example make it a premium only option ?

DivisionByZero
03-20-2004, 07:22 PM
is there going to be a new release for vb3 gold? I just did a clean install and am having serious problems with it... there was a lot of code rewrites in the new version, and none of the strings match :(

Boofo
03-20-2004, 07:31 PM
Are you sure? The code shouldn't have changed at all in the final release from RC3 at least.

DivisionByZero
03-20-2004, 08:28 PM
Are you sure? The code shouldn't have changed at all in the final release from RC3 at least.yes, I had rc4 and there are some differences in it, and I'm having major permissions issues.

Boofo
03-20-2004, 08:43 PM
I'm sure Kentaurus will upgrade his hack, but I will go through the code and see what needs to be changed in the meantime. There can't be that much to change to make it work. Sit tight. ;)

Red Blaze
03-26-2004, 02:48 PM
I installed it using vb3 gold and I'm having no problems at all. So far, it works just fine.

Boofo
03-26-2004, 02:56 PM
Can you post the differences in the code here for those that are having problems? ;)

hubba
03-26-2004, 07:47 PM
Uhm maybe this is a bug? I got an parse error in column 164. It is:

at line 156, search for this code:
-------------------------------------------------------------------

verify_forum_password($foruminfo['forumid'], $foruminfo['password']);

------------------------------------------------------------------
change it to:
-------------------------------------------------------------------

else if (!($forumperms & CANPOSTNEW) && !$privateattachment) // newthread.php
{
print_no_permission();
}

I removed the else from the if statement... now it works. Ok so?

Red Blaze
03-26-2004, 09:34 PM
That's odd, wonder if you copied it right because I didn't need to delete anything for it to work. If you backed up the files, try it one more time. There's no need to delete any part of the code.

msimplay
03-27-2004, 11:19 AM
heres a note for everyone thats using this hack
i had my files as attachments but the hack kept giving me invalid attachment error
but soon as i moved them back into the database everything was fixed
so my question would be is there anyway to make it work with files as attachments

Boofo
03-27-2004, 11:27 AM
That's how it is set up at my site and as you saw, it works fine. ;)

Vivi Ornitier
03-31-2004, 02:25 AM
So i'm kinda confused, how do u integrate this hack with erwin's quick pm reply hack? I think it was alreayd done but it was kinda vague what to do.

Boofo
03-31-2004, 02:40 AM
Kentuarus posted a how-to (either in here or Erwin's thread, I can't remember which now) for adding this to Erwin's Quick Reply. ;)

DivisionByZero
04-02-2004, 03:28 PM
I'm still having problems with vb 3 gold.... permissions errors when the recipient views an attachment :(

luroca
04-07-2004, 08:23 AM
Simply, this hack doesn't work in gold for me; it?s the only hack i have instaled in v.3 RC4 :(
There are some differences in scripts from releases ...

msimplay
04-07-2004, 03:05 PM
Simply, this hack don?t work in gold for me; it?s the only hack i have instaled in v.3 RC4 :(
There are some differences in scripts from releases ...
make sure attachments are in your database
it doesn't work with attachments as files
didn't for me anyway :p

Boofo
04-07-2004, 03:06 PM
I've got it working with attachments as files just fine. What version of vb3 did you have it not working that way?

luroca
04-07-2004, 03:34 PM
It works fine with attachments as files in RC4.
In Gold, all is apparently ok but in the privates there are no files :D

msimplay
04-07-2004, 04:55 PM
I've got it working with attachments as files just fine. What version of vb3 did you have it not working that way?
yep in gold

Boofo
04-07-2004, 05:38 PM
Well, I talked to Kentaurus and he said he is using Gold and this hack works fine for him.

DivisionByZero
04-07-2004, 06:44 PM
Well, I talked to Kentaurus and he said he is using Gold and this hack works fine for him.
This is very strange... how can the hack work fine in Gold when the code is totally different? I installed the hack three different times, and there's been major modifications in the code, and I'm still getting permissions errors when the recipient tries to view the attachments. :rolleyes:

DivisionByZero
04-11-2004, 07:39 PM
hello??? anybody???

Shane
04-11-2004, 07:43 PM
Will Install later

/me clicks install

luroca
04-13-2004, 08:10 AM
Perhaps this hack would be in beta releases ...

-Luroca clicks uninstall-

trinitym
04-14-2004, 03:04 AM
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*

Boofo
04-14-2004, 03:28 AM
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?

trinitym
04-14-2004, 03:38 AM
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:

// 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]:

// 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.

Boofo
04-14-2004, 04:31 PM
Sure, but no garauntees, maybe I just got lucky. ;)

This is the vB 3.0.0 Gold original profile.php:

// 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]:

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

trinitym
04-14-2004, 05:29 PM
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.

Boofo
04-14-2004, 05:44 PM
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. ;)

DivisionByZero
04-16-2004, 02:16 PM
umm... ok, doesn't anyone think it's time for a new release?

It's hard for me to flip through all these pages of modifications and implement each one.

JaNa
04-21-2004, 09:32 PM
Awesome!

NexVision
04-22-2004, 06:57 AM
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

Boofo
04-22-2004, 07:14 AM
Can someone please make an install file compatible with vb3.0.1 somehow? ;)

DivisionByZero
05-10-2004, 06:20 PM
Can someone please make an install file compatible with vb3.0.1 somehow? ;)YES, PLEASE!!!! I messed up 3 times lol

luroca
05-12-2004, 10:25 AM
I am very interested too :)

Kentaurus
05-16-2004, 06:51 AM
I wrote an updated version for 3.0.1, I tested it in a blank copy of vbulletin with attachments in the database and attachments as files and it worked ok :) If you find any bugs please let me know, it has been running on my forum for some time now anyway.

It is in the first post of this thread of course :)

Boofo
05-16-2004, 07:06 AM
I wrote an updated version for 3.0.1, I tested it in a blank copy of vbulletin with attachments in the database and attachments as files and it worked ok :) If you find any bugs please let me know, it has been running on my forum for some time now anyway.

It is in the first post of this thread of course :)
Welcome back, my friend. ;)

Kentaurus
05-16-2004, 08:13 AM
Welcome back, my friend. ;)
Thanks :) And expect all my hacks to be updated for 3.0.1 very very soon.

DivisionByZero
05-17-2004, 07:39 PM
OH my god, I'm getting these errors again... recipient gets an error page saying they do not have permission to view the attachment. WHAT am I donig wrong? I started on a clean VB installation, copied everything right, and think I did the SQL queries correctly... HELP!

DivisionByZero
05-17-2004, 07:47 PM
Here's what I got for the sql queries... here's what it setup on my database:


Table Field Name Type Allow Nulls Key Default Value
attachment private int(11) No Indexed 0
pmtext attach int(11) No None 0
attachment private int(11) No Indexed 0


somebody please tell me what I got wrong here? :(

msimplay
05-17-2004, 07:47 PM
OH my god, I'm getting these errors again... recipient gets an error page saying they do not have permission to view the attachment. WHAT am I donig wrong? I started on a clean VB installation, copied everything right, and think I did the SQL queries correctly... HELP! are you using attachments as files
because it doesn't work with them as of vbulletin 3.0

i had to move my attachments back into the database before they started to work again

if thats not it then i hope you have a good backup :nervous:

DivisionByZero
05-17-2004, 07:49 PM
my attachments are in the DB

Kentaurus
05-17-2004, 11:37 PM
OH my god, I'm getting these errors again... recipient gets an error page saying they do not have permission to view the attachment. WHAT am I donig wrong? I started on a clean VB installation, copied everything right, and think I did the SQL queries correctly... HELP!

Seems more like your problem is in attachment.php, since that is the one that deals with the permissions to view the attachment, if you edited it correctly then it should work.

DivisionByZero
05-17-2004, 11:45 PM
i believe it is done correctly. I will do it one more time just to be sure

DivisionByZero
05-20-2004, 02:33 AM
Ok, so I did EVERYTHING again, very slowly, step by step! Nothing! nada! still the same problem.. the recipient has no permission to view the attachments.

I need serious help here lol.

luroca
05-21-2004, 08:20 PM
3.0.1 clean installation with attachment in files, OK

**Install** :)

sketch42
06-01-2004, 10:19 AM
disregard this post... im an idiot
edits where made to the wrong line... :nervous:

sketch42
06-01-2004, 10:48 AM
I am still wondering if Erwin's is a quick pm.... he has all the pm reply screen there! :) Actually in my forum I edited it to only show the textarea and the submit button....

It should be possible to add them, I'll take a look at it.

Kentaurus can u please post this info... pleeeeeeeeeeeeeeeaaaaaaaase :)

Keyser S?ze
06-07-2004, 05:01 AM
odd, i installed the hack fine and everything works ok, when i send a attachment i see the attachment icon before the title but when i open the Pm there no attachment

i rewent over the hack again and everything is done correctly, anyone know what the problem is?

thanks

sketch42
06-25-2004, 03:25 AM
odd, i installed the hack fine and everything works ok, when i send a attachment i see the attachment icon before the title but when i open the Pm there no attachment

i rewent over the hack again and everything is done correctly, anyone know what the problem is?

thanks
my users are reporting this same problem as well vb3.0.1
anything???

paulomt1
06-27-2004, 12:08 PM
odd, i installed the hack fine and everything works ok, when i send a attachment i see the attachment icon before the title but when i open the Pm there no attachment

i rewent over the hack again and everything is done correctly, anyone know what the problem is?

thanks

I have the same problem here.

luroca
06-28-2004, 09:01 PM
I am having this problem too. I send a private with attachment, I receive it ok but later the attachment "disappears"

Some users never see the attachment.

SnowBot
06-29-2004, 12:35 AM
Any updates in getting this to show and work in Erwins quick reply pm hack? I know it was mensioned but i have read the thread and couldnt find anything. I know Boofo has it on his site so please :)

Thanks

luroca
07-03-2004, 12:53 PM
With the changes in 3.0.2 this hack needs changes too :)

Boofo
07-03-2004, 01:16 PM
Any updates in getting this to show and work in Erwins quick reply pm hack? I know it was mensioned but i have read the thread and couldnt find anything. I know Boofo has it on his site so please :)

Thanks
Check the thread for Erwin's hack. It is in there.

sketch42
07-03-2004, 11:09 PM
Boofo... have you gotten this hack to work with 3.0.1??

Boofo
07-04-2004, 12:33 AM
Boofo... have you gotten this hack to work with 3.0.1??
I don't run 3.0.1. I still run RC3. Sorry. :(

sketch42
07-04-2004, 01:04 AM
I don't run 3.0.1. I still run RC3. Sorry. :(
can someone update this for 3.0.1??

Ganon
07-09-2004, 02:43 AM
The hack worked fine for me on 3.0.0, but I've recently upgraded to 3.0.3, and it is incompatable. Some of the file edits no longer work (searching for the code brings no result), and my best guesses to fix it don't work. I can attach files to PM's, but it brings up an error message when the user tries to view those files.

luroca
07-09-2004, 09:57 AM
Yes, this very useful hack is not compatible with 3.0.3 :(

PKRWUD
07-14-2004, 03:06 PM
I am using 3.0.0, and am getting the following error when I try to view the attachment (both in the PM and in my CP)...

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/pkrwud/public_html/vbulletin/attachment.php on line 79

Any thoughts?

TTG
07-15-2004, 10:48 AM
Was hoping to get this working in 3.0.1 :ermm:

Got stuck with this :-

# Code modifications in file "attachment.php"
search for this code:


if (!$attachmentinfo = $DB_site->query_first("
SELECT filename, filesize, postid, attachment.userid,
" . iif(!$vboptions['attachfile'] AND !$thumb, 'filedata,') . "
" . iif($thumb, 'thumbnail, thumbnail_dateline AS dateline,', 'dateline,') . "
visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
WHERE attachmentid = $attachmentid
"))

Here's the nearest I could find in attachment.php

if (!$attachmentinfo = $DB_site->query_first("
SELECT filename, attachment.postid, attachment.userid, attachmentid,
" . iif($thumb, 'thumbnail AS filedata, thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,', 'attachment.dateline, filedata, filesize,') . "
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
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 . "forum AS forum ON (forum.forumid = thread.forumid)
" . iif($postid, "WHERE attachment.postid = $postid", "WHERE attachmentid = $attachmentid") . "
"))

Keyser S?ze
07-22-2004, 10:52 PM
ok this works fine for me in 3.0.1 BUT, when i load a PM with a attachment, takes forever, like a full 2 minutes to load the PM

thats the only problem, other PMs load very fast, almost instantly

moley
07-25-2004, 12:12 PM
when i used it on 3.0.1 i got an error

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ';
ALTER TABLE pmtext add attach int not null;
ALTER TABLE att

anyone know how to fix it?

Datenpapst
07-26-2004, 01:27 PM
aren't privat messages privat and only for the users themselfs?

moley
07-27-2004, 03:19 PM
a private message is from one person to another this hack can be used in this sorta of case user 1 made a new wallpaper and he wants to show his friend user 2. Instead of making a thread user 1 goes and makes a pm with the image attahment so that way the only two people who will see it are user 1 and user 2.

Also on your sites portal you seem to have latest thread replies twince once on the left hand colum and once under the latest news. justing pointing out.

weaver
08-02-2004, 03:28 PM
I can't find either of these pieces of code in private.php. I'm running 3.0.3.

$postid = verify_id('post', $attachmentinfo['postid']);

verify_forum_password($foruminfo['forumid'], $foruminfo['password']);

Weasel
08-24-2004, 03:32 AM
snobbymom, in that last piece of code just replace foruminfo with attachmentinfo everywhere you see it in the edit.

As for the " $postid = ..." I'm wondering the same thing myself. Its possible that that edit could be skipped.

Otherwise all of the edits are fairly straightforward even if they dont match the new 3.0.3 code exactly. Can anyone get this working in 3.0.3?

RobinHood
09-12-2004, 12:37 AM
Oh, guess what? I got this working for VB 3.0.3! :)

Took me an hour, but I got it! :)

A working demo of it is at http://www.generazn.com.

I will post a fix for this hack very soon. :)

RobinHood
09-12-2004, 01:13 AM
Okay, here is the fix! :)

First,

Open attachment.php:

Find:

if (!$attachmentinfo = $DB_site->query_first("
SELECT filename, attachment.postid, attachment.userid, attachmentid,
" . iif($thumb, 'thumbnail AS filedata, thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,', 'attachment.dateline, filedata, filesize,') . "
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
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 . "forum AS forum ON (forum.forumid = thread.forumid)
" . iif($postid, "WHERE attachment.postid = $postid", "WHERE attachmentid = $attachmentid") . "
"))

Replace with:

if (!$attachmentinfo = $DB_site->query_first("
SELECT filename, attachment.postid, attachment.userid, attachmentid,
" . iif($thumb, 'thumbnail AS filedata, thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,', 'attachment.dateline, filedata, filesize,') . "
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted, private,
thread.forumid, forum.password, thread.threadid
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON(attachmenttype.extension = SUBSTRING_INDEX(attachment.filename, '.', -1))
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(attachment.postid = deletionlog.primaryid AND type = 'post')
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 . "forum AS forum ON (forum.forumid = thread.forumid)
" . iif($postid, "WHERE attachment.postid = $postid", "WHERE attachmentid = $attachmentid") . "
"))

Next, find:

if ($attachment['postid'] == 0 AND $bbuserinfo['userid'] == $attachmentinfo['userid'])

On top of that, add the following:

if (!$attachmentinfo['private']) {
$postid = verify_id('post', $attachmentinfo['postid']);
}

Next, find:


if (!($forumperms & CANVIEW) OR !($forumperms & CANGETATTACHMENT))
{
print_no_permission();
}

// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']);


Replace it with the following:


if (!($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}

// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']);

$pmUsers = $DB_site->query_first("SELECT toUserArray FROM ".TABLE_PREFIX."pmtext WHERE pmtextid='".$attachmentinfo['private']."'");
$toUserArray = unserialize($pmUsers['toUserArray']);
if ($toUserArray[$bbuserinfo['userid']] != $bbuserinfo['username'] && $attachmentinfo['userid'] != $bbuserinfo['userid']) {
print_no_permission();
}



THAT'S IT! YOU'RE DONE!

It should be working now. If not, let me know because it is working for me. :)

btappan
09-12-2004, 08:34 PM
Props to RobinHood! up and working on my forums, no problems thus far! man does this hack take a while to install though!

Weasel
09-14-2004, 02:00 AM
I'm having problems with your code RobinHood, it seems to break the permissions of normal attachments, i.e. no one can view them now.

RobinHood
09-14-2004, 02:34 AM
I'm having problems with your code RobinHood, it seems to break the permissions of normal attachments, i.e. no one can view them now.

Okay, try this:

Change:


if (!($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}


To:


if (!($forumperms & CANVIEW) OR !($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}


That should do the trick. Let me know how it goes. :)

BamaStangGuy
09-14-2004, 05:08 AM
Okay, try this:

Change:


if (!($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}


To:


if (!($forumperms & CANVIEW) OR !($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}


That should do the trick. Let me know how it goes. :)
all my thumbnails are red x's and I get a no permisson

I have done what you said to do above and it still doesnt work

BamaStangGuy
09-14-2004, 05:12 AM
Something I just realized

It breaks all the thumbnails and images that were uploaded before the pm hack was installed. But if I upload a new image on the forum it works fine.

Basically all my old attachments show up as red x's and give a no permission when clicked.

But if I add a new attachment to a thread then it works fine

BamaStangGuy
09-14-2004, 05:57 AM
if (!($forumperms & CANGETATTACHMENT))
{
$vboptions['viewattachedimages'] = 0;
$vboptions['attachthumbs'] = 0;
}

// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']);

$pmUsers = $DB_site->query_first("SELECT toUserArray FROM ".TABLE_PREFIX."pmtext WHERE pmtextid='".$attachmentinfo['private']."'");
$toUserArray = unserialize($pmUsers['toUserArray']);
if ($toUserArray[$bbuserinfo['userid']] != $bbuserinfo['username'] && $attachmentinfo['userid'] != $bbuserinfo['userid']) {
print_no_permission();
}

It works fine until I had this part. Id di it in steps. Aded the first uploaded images showed. Added the second part images still showed. When I added the above part the images broke.

It still does it with what you posted in your lsat post as well

Weasel
09-14-2004, 10:38 AM
Yea same here, it breaks all previously uploaded attechments to the forum (thumbs and permissions to view).

Saphrym
09-14-2004, 05:49 PM
Yea same here, it breaks all previously uploaded attechments to the forum (thumbs and permissions to view).

Ok. Got this thing to work right in 3.0.3. I spent some time trying to figure out exactly what was trying to be done with the edits, and figured out how to do it.


Start with a fresh attachment.php (or one without the modifications for pms)

Find:
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid

Change to: (Purpose: Adds private as an option variable)
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid, private

Find:
if ($attachment['postid'] == 0 AND $bbuserinfo['userid'] == $attachmentinfo['userid'])

Add Above: (Purpose: Starts an if/then statement that if it's not a private message attachment do things like normal)
if (!$attachmentinfo['private']) {

Find:
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($attachmentinfo['forumid'], $attachmentinfo['password']);

if (!$attachmentinfo['visible'] AND !can_moderate($attachmentinfo['forumid'], 'canmoderateattachments') AND $attachmentinfo['userid'] != $bbuserinfo['userid'])
{
$idname = 'attachment';
eval(print_standard_error('error_invalidid'));
}
}

Add Below: (Purpose: Ends the if/then statement and adds what to do if it IS a private message attachment.)
} else {
$pmUsers = $DB_site->query_first("SELECT toUserArray FROM ".TABLE_PREFIX."pmtext WHERE pmtextid='".$attachmentinfo['private']."'");
$toUserArray = unserialize($pmUsers['toUserArray']);
if ($toUserArray[$bbuserinfo['userid']] != $bbuserinfo['username'] && $attachmentinfo['userid'] != $bbuserinfo['userid']) {
print_no_permission();
}
}

I've tested it with different users until I got the code working properly for both regular attachments and pm attachments. So this should work fine for those of you using 3.0.3.

Hope this helps.

BamaStangGuy
09-14-2004, 06:02 PM
It worked!!!

Thanks

Weasel
09-14-2004, 09:16 PM
Good job, the simplest solution is always the best, huh?

RobinHood
09-18-2004, 09:46 PM
Good job, the simplest solution is always the best, huh?
Is it just me or is there something wrong with the script? Why does it kept deleting the attachments right after a few hours or so???

AZone
09-19-2004, 06:23 PM
I am sorry, but can someone summarize all the steps I need to do to get it work? Or does the file in the first post contain complete solution?
Thank you.

Weasel
09-20-2004, 05:32 PM
Is it just me or is there something wrong with the script? Why does it kept deleting the attachments right after a few hours or so???

Hmm, you're right. It must be a problem in the cleanup cron. :disappointed:

beano33
09-20-2004, 09:40 PM
I am sorry, but can someone summarize all the steps I need to do to get it work? Or does the file in the first post contain complete solution?
Thank you.

I'd appreciate that too. A re-release for vBulletin Version 3.0.3 is what's needed.

Mattius
09-22-2004, 04:05 AM
the same problem occurs with the attachments for calendar hack. the same missing $postid code etc...

Ive posted a message there as well

theArchitect
09-22-2004, 11:48 PM
This Hack concept sounds sensational. But I am having a problem with the install. I have got down to the section where I need to modify the attachment.php file and I have been asked to find:

$postid = verify_id('post', $attachmentinfo['postid']);

But I can't find this code anywhere. I initially thought it was due to another hack I had installed. But I have checked the original vB 3.0.3 file and it isn't there either. Nor is the next line of code:

verify_forum_password($foruminfo['forumid'], $foruminfo['password']);

Assistance would be most appreciated.

Mattius
09-23-2004, 06:42 AM
Many others are in the same boat :) Its not in the 3.0.3 code, this current hack is designed for 3.0.0 and 3.0.1...but with relatively small changes you should be able to get it too work in 3.0.3.

The problem gets worse when your trying to implement the calendar hack as well because modify identical bits of code, which i sort of had working apart from the fact the attachment disappears after a while :)...a couple others have had the same problem here...Im using 3.0.3.

We really need a genius to come along and sort it all out for us. Unfortunately im not that genius :)

theArchitect
09-23-2004, 06:49 AM
Many others are in the same boat :) Its not in the 3.0.3 code, this current hack is designed for 3.0.0 and 3.0.1...
yes, for the first time what version of vB I am using is becoming an issue (I am very new to hacks). I am also dreading what will happen when vB produce the next release. I am not looking forward to having to re-install all of my hacks.

Mattius
09-23-2004, 08:09 AM
Yup hopefully more hack writers will use the HTL script, so it will be easy to adminster hacks...

Dont loose hope though i im pretty sure this particular hack will be modified for 3.0.3 soon...

btappan
09-29-2004, 04:59 PM
Is it just me or is there something wrong with the script? Why does it kept deleting the attachments right after a few hours or so???

anybody fix this yet? can i make it delete them after they are a week old or something?

btappan
10-01-2004, 01:39 AM
do you think if we just revert the clean up file it would work temporarily at least to avoid pm attachments being deleted. they would probably build up but couldnt we manually clear them out once in a while?

theArchitect
10-01-2004, 02:37 AM
anybody fix this yet? can i make it delete them after they are a week old or something?
As I understand, the attachment exists so long as the PM does. So once the PM is deleted so too is the attachment.

I would probably leave it like this as if attachments are auto deleted you will get lots of complaint PMs about "where have my attachments gone?"

As for the build up, This is something users need to control (unless you have restrictions on your web space). Just set the attachment allowance to a lower number, then users will need to delete older (or less important ) attachments before they can include new ones.

RobinHood
10-01-2004, 03:04 AM
anybody fix this yet? can i make it delete them after they are a week old or something?
I already tried that. The attachment would still be deleted even though the PM still exists. The attachment would be deleted within a few hours.

btappan
10-01-2004, 04:14 PM
believe me, the attachments are being deleted even when the pm is still there. I have informed my users to not delete any messages to test what is happening. no one has deleted their messages, and the attachments are still dissappearing.

btappan
10-01-2004, 04:42 PM
I have determined from my testing that the attachments are being deleted shortly after they have been viewed, not when the user deletes the PM. Also, if I send another user a PM attachment and then look at what i sent them in my sent items folder before the recipient has even looked at it, it is usually deleted before they view it unless they look at it quick enough b4 it gets cleaned out by thr cron file. so wether the sender or the recipient views the attachment once it has been sent, it will be deleted shortly thereafter. back to my original question: can i temporarily fix this by reverting my cleanup file? i don't really care if the attachments aren't being deleted in the mean time until someone comes up with a fix for this. let me know

Kentaurus
10-05-2004, 02:23 AM
I'm really really sorry about not upgrading this hack, I have it upgraded in my forum and there are a couple modifications that have to be made to make it compatible with 3.0.3. theArchitect sent me a pm today and I headed here to upgrade my hack as fast as I could :)

I originally designed this hack for RC3 and upgraded it until gold, but I haven't had time lately to upgrade my hacks (or to document them). Anyway, I'll attach in the first post the upgraded txt for the 3.0.3 vbulletin.

About the cron job. Hourly all the orphan attachments (that is the attachments that were uploaded but the post was never commited) are deleted. When my hack is not installed then an attachment in the pm counts as a not commited attachment (that are the replacements in the cleanup2.php file). That is new behaviour in 3.0.3, in earlier versions they checked the posthash instead of the postid.

That would mean that if you upgraded to 3.0.3 and didn't upgrade the hack you might've lost your private attachments. You'd need to edit the files (or at least the cleanup2.php, then upgrade to 3.0.3 for your attachments to be safe.

theArchitect
10-05-2004, 11:31 PM
I'm really really sorry about not upgrading this hack, I have it upgraded in my forum and there are a couple modifications that have to be made to make it compatible with 3.0.3. theArchitect sent me a pm today and I headed here to upgrade my hack as fast as I could :) Many thanks, you assistance is most appreciated.

However I am having a problem with the install. I have rechecked my work but am getting the following error message when I try and upload an attachment:

Invalid Post specified. If you followed a valid link, please notify the webmaster

I also recieved a DB error report:

Database error in vBulletin 3.0.3:

Invalid SQL:

DELETE FROM attachment

WHERE postid = 0 AND private = 0 AND

dateline < 1097016998
mysql error: Unknown column 'private' in 'where clause'

mysql error number: 1054

Do you have any thoughts as to what stage of the hack install I have done incorrectly?

RobinHood
10-06-2004, 03:57 AM
Many thanks, you assistance is most appreciated.

However I am having a problem with the install. I have rechecked my work but am getting the following error message when I try and upload an attachment:

Invalid Post specified. If you followed a valid link, please notify the webmaster

I also recieved a DB error report:

Database error in vBulletin 3.0.3:

Invalid SQL:

DELETE FROM attachment

WHERE postid = 0 AND private = 0 AND

dateline < 1097016998
mysql error: Unknown column 'private' in 'where clause'

mysql error number: 1054

Do you have any thoughts as to what stage of the hack install I have done incorrectly?
Make sure you have "private" column in the attachment table.

theArchitect
10-06-2004, 06:46 AM
Make sure you have "private" column in the attachment table.
Bizarre. I re-checked this on one of my test forums and ended up with the error that the row had already been added (when I tried it I got rows affected 0).

So I ran the entire install process on a different board and everything seems to be working fine. I guess I will just have to put it down to another vB X File.

But thankyou for your help.

btappan
10-06-2004, 02:11 PM
About the cron job. Hourly all the orphan attachments (that is the attachments that were uploaded but the post was never commited) are deleted. When my hack is not installed then an attachment in the pm counts as a not commited attachment (that are the replacements in the cleanup2.php file). That is new behaviour in 3.0.3, in earlier versions they checked the posthash instead of the postid.

So if I reinstall the entire hack with your new release it will cure my current problem of pm attachments being deleted hourly once they have been viewed? also, how different is your release compared to the other? Am I going to have a problem running the commands since I already have the last version installed?

Kentaurus
10-10-2004, 12:23 AM
Yes, it should cure that problem. However for that you need only to modify the cleanup2.php file in your includes/cron directory (with the instructions in the hack)

Only attachment.php and cleanup2.php have heavy modifications, you might want to check only those if it is already installed and working.

Debbi
10-22-2004, 07:21 AM
I would LOVE to have this mod for 3.0.3. Any chance of this in the near future?

btappan
10-24-2004, 11:40 PM
uh, did you read any of this? its working for it now

ezsouljahs
10-28-2004, 04:20 AM
Add a new phrase and make sure it is in the "posting" phrase type, otherwise it won't work

phrase: in_private_message
Text: Private Message

how do i add a new phrase

h75
11-10-2004, 10:08 AM
I get an error, wenn i attach an txt-file an klick send. :nervous:
Datenbankfehler in vBulletin 3.0.3:

Ungueltige SQL-Abfrage:
UPDATE attachment
SET private = , posthash = ''
WHERE posthash = '7812b835551ecc43a34408135f1b1774' AND
userid = 1

mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' posthash = ''
WHERE posthash = '7812b8

mysql error number: 1064

Datum: 10.11.2004 13:05:01
Skript: http://halloo.de/private.php
Referer: http://halloo.de/private.php?do=newpm&pmid=619
Benutzername: H75
IP-Adresse:

h75
11-10-2004, 10:40 AM
and this:

Datenbankfehler in vBulletin 3.0.3:

Ungueltige SQL-Abfrage: INSERT INTO pm (pmtextid, userid, folderid, messageread) VALUES (, 1, -1, 1)
mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1, -1, 1)' at line 1

mysql error number: 1064

Datum: 10.11.2004 13:07:40
Skript: http://halloo.de/private.php
Referer: http://halloo.de/private.php?do=newpm&pmid=619
Benutzername: H75
IP-Adresse::

seraphex
11-12-2004, 03:09 AM
ok.. I've installed this and reverted back to my original files (other than my template edits) like 4 times. It looks like everything works except the attachment does not show up in the pm when it's opened. I just noticed that I had the following line wrong in my pm_newpm template. And I'm curious if this would cause the attachment to not show up. I'm almost done removing it and I hate to redo everything again just to find out that this had no effect on things. Here's the line I had wrong (just missing the closing >):

<input type="hidden" name="poststarttime" value="$poststarttime" /

vs.

<input type="hidden" name="poststarttime" value="$poststarttime" />

JKeats
11-18-2004, 05:16 PM
nm... fixed. sorry.

Scerina
11-22-2004, 12:49 AM
I just upgraded to version 3.03 and I am having problems editing the attachment.php file cause it differs from 3.0 and am sure the other files are the same way. I manage to edit private.php file with no problem.

Is this hack compatiable with version 3.03 and if so, what are the file modification instructions for it? Thanx in advance

T3MEDIA
12-12-2004, 12:19 AM
Thank god I read this last post.

I thought they said this was 3.0.3 compatable.
I really dont like the idea of this site. Its soo cool that users help and put up hacks but It feels like we are greedy lab rats. I wish they made it that once its 100% its like a install. you click enter what ever and "patch" your site.
keeps a record and ya set. that way if I make a hack that confilcts you will know. blah blah does not work with this patch.

Im I crazy or does that make sense? shoot I would pay for that.

T3MEDIA
12-18-2004, 11:17 PM
Ok works like a charm. Thank you. Only down side is the attachments stay. If I send a private message it should be on his/hers quota not mine. so if they want to keep it they can. also what if you want to send 3 differn people a picture of youself. you already have it saved on the site. so you cant re upload it. you have to delte your attachments. it should be a bit more seperate in that sense from forums.

BlasterT3
01-24-2005, 08:12 PM
thanks alot for this hack i love it but i think i might of found a bug

as u can see in the attached img the file i attached in a pm shows up twice