• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Hide Posts From Guests

borbole

Well-known member
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>

The end result can be seen at the below attached screenshot.
 

Attachments

  • - XenForo_1286896341627.webp
    - XenForo_1286896341627.webp
    33.6 KB · Views: 346
Thank you borbole. It would much better where certain bbcodes & links could be hidden from public rather the entire post.
 
I'm going to try it on one of my new forums. It's been up for a couple weeks and we're getting very little traffice from SE's anyway. I've been advertising on Facebook and we've been getting a LOT of clicks (and cheap - 2 cents each) but very few people registering. We have a lot of videos and I think people are watching them and leaving. So maybe this'll be some incentive to register. Once traffic picks up a bit I'll remove it. Anyway, thanks for the template edit!
 
Top Bottom