1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
  3. 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

Discussion in 'Template Modifications [Archive]' started by borbole, Oct 12, 2010.

  1. borbole

    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.

    Attached Files:

    freecode, kilcher, Dean and 6 others like this.
  2. Dav

    Dav Active Member

    Hi Borbole, thats fantastic ill try that
    Thanks
    borbole likes this.
  3. D37

    D37 Active Member

    How is this for SEO?
  4. D37

    D37 Active Member

    just installed. What a kick ass mod!!! :) thank you!
    borbole likes this.
  5. borbole

    borbole Well-Known Member

    Thanks for your feedbacks/comments/likes guys. I appreciate them :)
  6. ArnyVee

    ArnyVee Well-Known Member

    Can you make it so that it only displays the first post and then the rest are 'hidden'?
    erich37, Deepmartini and D.O.A. like this.
  7. Dav

    Dav Active Member

    This is great it works fine and is exactly what i was after thanks borbole. :)
    borbole likes this.
  8. borbole

    borbole Well-Known Member

    That would be best as a separate modification in my opinion.

    You are welcome :)
  9. ArnyVee

    ArnyVee Well-Known Member

    Wouldn't it simply be a conditional placed on this same add-on?
  10. borbole

    borbole Well-Known Member

    ArnyVee, Dean and D.O.A. like this.
  11. yavuz

    yavuz Well-Known Member

    Thank you borbole. It would much better where certain bbcodes & links could be hidden from public rather the entire post.
    borbole likes this.
  12. lms

    lms Well-Known Member

    Thanks for the mod.

    Salud2
    borbole likes this.
  13. borbole

    borbole Well-Known Member

    You are welcome guys :)
  14. ragtek

    ragtek Guest

    Bad, because you have no content for the Search Engine^^
  15. Kaiser

    Kaiser Well-Known Member

    Thats why I wouldnt use it..
  16. kilcher

    kilcher Active Member

    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!

Share This Page