Quote:
Originally Posted by Weasel
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:
PHP Code:
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid
Change to: (Purpose: Adds private as an option variable)
PHP Code:
attachment.visible, mimetype, NOT ISNULL(deletionlog.primaryid) AS isdeleted,
thread.forumid, forum.password, thread.threadid, private
Find:
PHP Code:
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)
PHP Code:
if (!$attachmentinfo['private']) {
Find:
PHP Code:
// 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.)
PHP Code:
} 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.