This add-on enables users to attach files to personal conversations. It works exactly the same as attaching files to posts.
To note:
There are no quota restrictions.
Attachments remain on the server until all members leave the conversation.
There are 2 permissions, one to upload attachments, and another to view them.
I coded this for my own forum a little while back, I do not plan on developing it much further, as it suits my needs. Nevertheless, feel free to post any suggestions/feedback.
If your templates are not modified, you may simply replace them with the versions in the TemplateEdits.zip instead of performing the edits.
Installation
- Upload the contents of the upload folder to the root of your forum.
- Go to your Admin CP > Install Add-on and upload the addon-conversationAttachments.xml file.
- Apply the template edits that follow.
- Set permissions for "View attachments" and "Add attachments" under "Personal Conversation Permissions"
Template Edits
In conversation_add:
Find:
Add below:PHP Code:
<input type="submit" value="{xen:phrase start_conversation}" accesskey="s" class="button primary" />
Find:PHP Code:
<xen:include template="attachment_upload_button" />
PHP Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
Add above:
In conversation_reply:PHP Code:
<xen:if is="{$attachmentParams}">
<dl class="ctrlUnit AttachedFilesUnit">
<dt><label for="ctrl_uploader">{xen:phrase attached_files}:</label></dt>
<dd><xen:include template="attachment_editor" /></dd>
</dl>
</xen:if>
Find:
Add below:PHP Code:
<input type="submit" value="{xen:phrase reply_to_conversation}" accesskey="s" class="button primary" />
PHP Code:
<xen:include template="attachment_upload_button" />
Find:
PHP Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
Add above:
In conversation_message_edit:PHP Code:
<xen:if is="{$attachmentParams}">
<dl class="ctrlUnit AttachedFilesUnit">
<dt><label for="ctrl_uploader">{xen:phrase attached_files}:</label></dt>
<dd><xen:include template="attachment_editor" /></dd>
</dl>
</xen:if>
Find:
PHP Code:
<input type="submit" value="{xen:phrase save_changes}" accesskey="s" class="button primary" />
Add below:
Find:PHP Code:
<xen:include template="attachment_upload_button" />
PHP Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
PHP Code:
Add above:
In conversation_message:PHP Code:
<xen:if is="{$attachmentParams}">
<dl class="ctrlUnit AttachedFilesUnit">
<dt><label for="ctrl_uploader">{xen:phrase attached_files}:</label></dt>
<dd><xen:include template="attachment_editor" /></dd>
</dl>
</xen:if>
Add at top:
Find:PHP Code:
<xen:require css="conversationAttachments_conversation_message.css" />
Add below:PHP Code:
<xen:set var="$messageId">message-{$message.message_id}</xen:set>
UninstallationPHP Code:
<xen:set var="$messageContentAfterTemplate"><xen:if is="{$message.attachments}"><xen:include template="attached_files"><xen:map from="$message" to="$post" /></xen:include></xen:if></xen:set>
Please note all attachments will be unassociated upon uninstallation, and will subsequently be deleted.
- Revert all your template edits.
- Go to your Admin CP > Manage Add-ons > Conversation Attachments > Controls > Uninstall
- Remove the ConversationAttachments folder from the /library directory of your XenForo installation.
Bookmarks