1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Attachment for guests

Discussion in 'XenForo Questions and Support' started by Razfaz, Jun 1, 2012.

  1. Razfaz

    Razfaz Member

    Hi,
    if we upload a picture as attachment, the guest can see the thumbnail.
    Is it possible to set the permission, that guest cant see the thumbnails in the Threads?

    Kind regards
    Marco
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That thumbnails are public and are not controlled with permissions. But you can edit the templates to do what you want:

    Admin CP -> Appearance -> Templates -> attached_files

    Remove the red code:

    Code:
    					<div class="thumbnail">
    						<xen:if is="{$attachment.thumbnailUrl} AND {$canViewAttachments}">
    							<a href="{xen:link attachments, $attachment}" target="_blank" class="LbTrigger"
    								data-href="{xen:link misc/lightbox}"><img 
    								src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" class="LbImage" /></a>
    						<xen:elseif is="{$attachment.thumbnailUrl}" />
    							<a href="{xen:link attachments, $attachment}" target="_blank"><img
    								src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" /></a>
    						<xen:else />
    							<a href="{xen:link attachments, $attachment}" target="_blank" class="genericAttachment"></a>
    						</xen:if>
    					</div>
    
    That should do it.
     
    Razfaz likes this.
  3. Razfaz

    Razfaz Member

    This works fine, thanks! :)
     
  4. snoopy5

    snoopy5 Well-Known Member



    Does not work for me. This is all my code:

    Code:
    <xen:require css="attached_files.css" />
     
    <div class="attachedFiles">
        <h4 class="attachedFilesHeader">{xen:phrase attached_files}:</h4>
        <ul class="attachmentList SquareThumbs"
            data-thumb-height="{xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 2'}"
            data-thumb-selector="div.thumbnail > a">
            <xen:foreach loop="$post.attachments" value="$attachment">
                <li class="attachment{xen:if {$attachment.thumbnailUrl}, ' image'}" title="{$attachment.filename}">
                    <div class="boxModelFixer primaryContent">
                       
                        <div class="thumbnail">
                            <xen:if is="{$attachment.thumbnailUrl} AND {$canViewAttachments}">
                                <a href="{xen:link attachments, $attachment}" target="_blank" class="LbTrigger"
                                    data-href="{xen:link misc/lightbox}"><img
                                    src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" class="LbImage" /></a>
                            <xen:elseif is="{$attachment.thumbnailUrl} AND 0" />
                                <a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a>
                            <xen:else />
                                <a href="{xen:link attachments, $attachment}" target="_blank" class="genericAttachment"></a>
                            </xen:if>
                        </div>
                       
                        <div class="attachmentInfo pairsJustified">
                            <h6 class="filename"><a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a></h6>
                            <dl><dt>{xen:phrase file_size}:</dt> <dd>{xen:number $attachment.file_size, size}</dd></dl>
                            <dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $attachment.view_count}</dd></dl>
                        </div>
                    </div>
                </li>
            </xen:foreach>
        </ul>
    </div>
     
    <xen:comment><xen:require css="xenforo.css" /></xen:comment>
     

Share This Page