xF1 Hide Posts From Guests

  • Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Radio

    luigi86

    Member
    Member
    Dec 4, 2016
    6
    0
    1
    Spain
    luigi86 submitted a new resource:

    - Hide Posts From Guests 2015-11-14

    This is a simple template modification which will hide the post contents from guests and show them a message instead. Which you can alter to fit your needs.

    At the message template replace all the code in there with the following code:

    Code:
    <xen:require css="message.css" />
    <xen:require css="bb_code.css" />
    <li id="{$messageId}" class="message{xen:if $message.isDeleted, ' deleted'}{xen:if '{$message.is_admin} OR {$message.is_moderator}', ' staff'}" data-author="{$message.username}">
    
        <xen:include template="message_user_info">
            <xen:map from="$message" to="$user" />
        </xen:include>
        <div class="messageInfo">
            <br /><br />
           <xen:if is="!{$visitor.user_id}">
           <p class="importantMessage">Hello there guest. Please <a href="{xen:link 'register/'}">Register</a> or <a href="{xen:link 'login/'}">login</a> to view the posts!</p>
           <xen:else />
            <xen:if is="{$message.isNew}"><span class="newIndicator"><span></span>{xen:phrase new}</span></xen:if>
            <xen:if hascontent="true">
                <ul class="messageNotices">
                    <xen:contentcheck>
                        <xen:if is="{$message.isDeleted}">
                            <li class="deletedNotice">{xen:phrase this_message_has_been_removed_from_public_view}</li>
                        <xen:elseif is="{$message.isModerated}" />
                            <li class="moderatedNotice">{xen:phrase this_message_is_awaiting_moderator_approval_and_is_invisible_to_normal}</li>
                        </xen:if>
                    </xen:contentcheck>
                </ul>
            </xen:if>
    
            <div class="messageContent">
                <article><blockquote class="messageText ugc baseHtml">{xen:raw $message.messageHtml}</blockquote></article>
    
                {xen:raw $messageContentAfterTemplate}
            </div>
                 </xen:if>
    
            <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
                <div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
            </xen:if>
    
            {xen:raw $messageAfterTemplate}
    
            <div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
        </div>
    
    </li>

     
    Last edited:

    luigi86

    Member
    Member
    Dec 4, 2016
    6
    0
    1
    Spain
    Hi, I've always used this in xenforo 1, so some way to put it in xenforo 2, so that the guests can not see the posts.
     

    ven0m

    Administrator
    Staff member
    Administrator
    Moderator
    Platinum
    xenForo 2.x.x
    xenForo 1.x.x
    Contributor
    vBulletin All Access Pass
    The Chest
    Verified
    Ultra Platinum VIP
    Platinum VIP
    Gold VIP
    Silver VIP
    Premium
    Member
    Jul 17, 2005
    20,503
    7,742
    321
    localhost
    Hi, I've always used this in xenforo 1, so some way to put it in xenforo 2, so that the guests can not see the posts.
    You do know that by doing that it will kill your SEO right?
     

    ven0m

    Administrator
    Staff member
    Administrator
    Moderator
    Platinum
    xenForo 2.x.x
    xenForo 1.x.x
    Contributor
    vBulletin All Access Pass
    The Chest
    Verified
    Ultra Platinum VIP
    Platinum VIP
    Gold VIP
    Silver VIP
    Premium
    Member
    Jul 17, 2005
    20,503
    7,742
    321
    localhost
    What can be done so that the contents can not be seen and SEO indexed well?
    That would require a custom plugin I would think or someone that knows the crap out of their conditional statements for xenforo 2. I am not even sure that could be done correctly without harming your seo to be honest. If the spiders can't see it then it will not get indexed.