[TH] Attachments Plus [Deleted]

We don't have it in the editor but to make it a bit easier for our members we changed the 'trash can' delete icon to be a 'copy & paste' command instead with images wrapped in a IMG tag and non-images wrapped in an ATTACH tag. This is for when a person is viewing their own attachments in their account settings but could be applied to the Profile tab just as well. If this might help, I can post the template change.

View attachment 222758
Would you mind sharing this edit please, Kevin? 😊
 
Would you mind sharing this edit please, Kevin? 😊
Whoops, didn't see this one earlier.

Here's the edit I'm using to the thattachmentsplus_attachment_manager_list template and screenshot of how it appears to the user.

Find:
Code:
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>

Replace with:
Code:
<xf:comment>
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>
</xf:comment>
<xf:cell class="dataList-cell">
    <xf:if is="$attachment.has_thumbnail">
        <xf:set var="$attachmentCopyBBCode" value="[img alt='{$attachment.Data.filename}']{{ link('canonical:attachments', $attachment ) }}[/img]" />
    <xf:else />
        <xf:set var="$attachmentCopyBBCode" value="[ATTACH]{$attachment.attachment_id}[/ATTACH]" />
    </xf:if>
    <xf:macro template="share_page_macros" name="share_clipboard_input"
        arg-label="{{ phrase('copy_to_clipboard') }}"
        arg-text="{$attachmentCopyBBCode}" />
</xf:cell>

That should be smart enough then to use an [img] tag for image attachments and an [attach] for other file types but it's easy enough to change as wanted.

Here's a screen shot of how it looks at our Cameraderie photography forum....
1608429835458.webp
 
Hello @ThemeHouse, any updates on this add-on for 2.2?

I’m really needing this actually and ready to renew my license.

Would be great if we have more prune/delete options, some users, etc, because my Forum have a lot of then.

Thanks.
 
Whoops, didn't see this one earlier.

Here's the edit I'm using to the thattachmentsplus_attachment_manager_list template and screenshot of how it appears to the user.

Find:
Code:
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>

Replace with:
Code:
<xf:comment>
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>
</xf:comment>
<xf:cell class="dataList-cell">
    <xf:if is="$attachment.has_thumbnail">
        <xf:set var="$attachmentCopyBBCode" value="[img alt='{$attachment.Data.filename}']{{ link('canonical:attachments', $attachment ) }}[/img]" />
    <xf:else />
        <xf:set var="$attachmentCopyBBCode" value="[ATTACH]{$attachment.attachment_id}[/ATTACH]" />
    </xf:if>
    <xf:macro template="share_page_macros" name="share_clipboard_input"
        arg-label="{{ phrase('copy_to_clipboard') }}"
        arg-text="{$attachmentCopyBBCode}" />
</xf:cell>

That should be smart enough then to use an [img] tag for image attachments and an [attach] for other file types but it's easy enough to change as wanted.

Here's a screen shot of how it looks at our Cameraderie photography forum....
View attachment 242531

I notice with this that you include the initial 'delete' code in your edit yet the delete function doesn't show - is there a reason for this?
 
Whoops, didn't see this one earlier.

Here's the edit I'm using to the thattachmentsplus_attachment_manager_list template and screenshot of how it appears to the user.

Find:
Code:
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>

Replace with:
Code:
<xf:comment>
<xf:if is="$attachment.canTHAttachPlusDelete()">
    <xf:delete href="{{ link('account/th-attachment-manager/delete', $attachment) }}" />
<xf:else />
    <xf:cell class="dataList-cell--min" />
</xf:if>
</xf:comment>
<xf:cell class="dataList-cell">
    <xf:if is="$attachment.has_thumbnail">
        <xf:set var="$attachmentCopyBBCode" value="[img alt='{$attachment.Data.filename}']{{ link('canonical:attachments', $attachment ) }}[/img]" />
    <xf:else />
        <xf:set var="$attachmentCopyBBCode" value="[ATTACH]{$attachment.attachment_id}[/ATTACH]" />
    </xf:if>
    <xf:macro template="share_page_macros" name="share_clipboard_input"
        arg-label="{{ phrase('copy_to_clipboard') }}"
        arg-text="{$attachmentCopyBBCode}" />
</xf:cell>

That should be smart enough then to use an [img] tag for image attachments and an [attach] for other file types but it's easy enough to change as wanted.

Here's a screen shot of how it looks at our Cameraderie photography forum....
View attachment 242531

a nice little addition thank you for this....it is a little confusing tho because you have it in "your account > attachments" but not in the tab in the profile area....would be nice to have it consistant in both places if possible.

thank you
 
I notice with this that you include the initial 'delete' code in your edit yet the delete function doesn't show - is there a reason for this?
fwiw, we cant see the delete function even without this hack....not sure whats up there be nice tho yeah...

EDIT:
correction its only in the tab in profile it doesnt display
 
@ThemeHouse i got an error with XF2.2.3 and this addon version 1.0.1 PL5

Code:
Server error log
ErrorException: Template error: [E_USER_WARNING] Cannot call method canView on a non-object (NULL) src/XF/Template/Templater.php:1151
Generated by: admin Feb 14, 2021 at 3:18 PM
Stack trace
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, '[E_USER_WARNING...', '/var/www/vhosts...', 1151, Array)
#1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l2/s16/public/thattachplus_member_images.php(34): XF\Template\Templater->method(NULL, 'canView', Array)
#3 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thattachplus_me...', Array)
#5 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#6 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('ThemeHouse\\Atta...', 'public:thattach...', Array)
#7 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Json->renderView('ThemeHouse\\Atta...', 'public:thattach...', Array)
#8 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#10 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#11 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#12 src/XF.php(488): XF\App->run()
#13 index.php(20): XF::runApp('XF\\Pub\\App')
#14 {main}
Request state
array(4) {
  ["url"] => string(165) "/members/admin.1/thattachplus-images/?_xfRequestUri=%2Fmembers%2Fadmin.1%2F&_xfWithData=1&_xfToken=1613312305%2C662c641e071aa52325545c620b42c87b&_xfResponseType=json"
  ["referrer"] => string(45) "https://www.domain.com/members/admin.1/"
  ["_GET"] => array(4) {
    ["_xfRequestUri"] => string(17) "/members/admin.1/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "1613312305,662c641e071aa52325545c620b42c87b"
    ["_xfResponseType"] => string(4) "json"
  }
  ["_POST"] => array(0) {
  }
}
 
I believe it only shows the tabs when there are attachments to display in them. There's a separate one for Attachments and Images if it's been configured that way, and it intelligently hides them when there's nothing to show. That user doesn't seem to have any attachments, but the Images tab shows on this user for example.
 
I love this add-on but it's riddled with errors on the latest version.

This is just one of tons of these messages in my ACP:

Screen Shot 2021-03-15 at 9.26.18 PM.webp
 
Top Bottom