Version: 1.00, by Admin (Coder)
Developer Last Online: Nov 2024
Version: 2.2.x
Rating:
Released: 03-01-2002
Last Update: Never
Installs: 54
No support by the author.
*drums* This hack is now out of beta! Safe to use.
My latest and one of the more extensive hacks -- Private Attachments!
This huge (I ain't kidding, it's pretty big) hack will allow your members to send private messages with attachments in them, so they don't need to use e-mail for that.
Since this hack requires a large number of edits, this is how I recommend installing it:
(a) Run the queries.
(b) Edit all the files, offline.
(c) When you are done with (b) upload all the files at once.
(d) Perform the template edits.
If you do all actions in this order your users shouldn't notice you are installing the hack.
All feature requests (except for limiting this for usergroups -- if you want that do it yourself it's not hard but I'm tired of adding permissions to the dreaded usergroup.php) are welcome before this goes out of beta.
As always, have fun.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
i already posted about this problem before, but didnt get any feedback yet. I rechecked the hack installation today and updated it to the current version, but it hasnt made any difference to my problem.
At first all seems to work fine, the attachment can be added and shows up in the receveivers and senders pm's. However after about 30 min. the icon and link for the attachment download disappears aswell at the number for the amount of times it was downloaded. Its really weird.
Im attaching a screenshot, of how the pm looks after 30 min or so. Would appreciate any help.
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
$postinfo = $DB_site->query_first('
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = '.intval($HTTP_POST_VARS['attachmentid']).' AND visible = 0
');
if (intval($HTTP_POST_VARS['attachmentid']) != 0 and $postinfo) {
$oldattachid = $postinfo['attachmentid'];
} else {
unset($oldattachid);
}
if ($orphans = $DB_site->query("SELECT a.attachmentid FROM attachment AS a LEFT JOIN post USING (attachmentid) WHERE postid IS NULL") and $DB_site->num_rows($orphans) > 0) {
$orphanids = '0';
while ($orphan = $DB_site->fetch_array($orphans)) {
$orphanids .= ",$orphan[attachmentid]";
}
$DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($orphanids) AND dateline < ".(time() - (60*15))." AND attachmentid <> ".intval($oldattachid));
}
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
With this:
PHP Code:
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
$postinfo = $DB_site->query_first('
SELECT attachmentid, filename FROM attachment
WHERE attachmentid = '.intval($HTTP_POST_VARS['attachmentid']).' AND visible = 0
');
if (intval($HTTP_POST_VARS['attachmentid']) != 0 and $postinfo) {
$oldattachid = $postinfo['attachmentid'];
} else {
unset($oldattachid);
}
if ($orphans = $DB_site->query("
SELECT a.attachmentid
FROM attachment AS a
LEFT JOIN post ON (post.attachmentid = a.attachmentid)
LEFT JOIN privatemessage ON (privatemessage.attachmentid = a.attachmentid)
WHERE postid IS NULL AND privatemessageid IS NULL
") and $DB_site->num_rows($orphans) > 0) {
$orphanids = '0';
while ($orphan = $DB_site->fetch_array($orphans)) {
$orphanids .= ",$orphan[attachmentid]";
}
$DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($orphanids) AND dateline < ".(time() - (60*15))." AND attachmentid <> ".intval($oldattachid));
}
// **************************************** \\
// *** Keep attachments when previewing *** \\
// **************************************** \\
Have everybody make this one:
"except for limiting this for usergroups -- if you want that do it yourself it's not hard but I'm tired of adding permissions to the dreaded usergroup.php"
i want that only mods and admins can posting attachements. Can everybody help me?