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.
    Dismiss Notice
  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.

Guests See First Post Only

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

  1. borbole

    borbole Well-Known Member

    This is a simple template modification which will show the first post only to guests and hide the rest 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:

    <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" />
        <div class="messageInfo">
            <br /><br />
           <xen:if is="!{$visitor.user_id} && !{$post.isFirst}">
           <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: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>
            <div class="messageContent">
                <article><blockquote class="messageText ugc baseHtml">{xen:raw $message.messageHtml}</blockquote></article>
                {xen:raw $messageContentAfterTemplate}
            <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
                <div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
            {xen:raw $messageAfterTemplate}
            <div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>

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

    Attached Files:

  2. ArnyVee

    ArnyVee Well-Known Member

    Will probably be using this. Thanks :)
    borbole likes this.
  3. borbole

    borbole Well-Known Member

    You are welcome :)
  4. najaru

    najaru Active Member

    Screenshot please ;)
  5. borbole

    borbole Well-Known Member

    Ah, I forgot. Now it is added under the first post :)
  6. najaru

    najaru Active Member

    ok thanks.

    and SEO is modified? Spider can see the articles?
  7. DSF

    DSF Well-Known Member

    Oh, oh ... Google do like this. :D
  8. joX

    joX Active Member

    Could you post the code for having spiders treated just as unregistered guests. I'm not a huge fan of serving spiders different content than regular visitors as it could lead to a penalty should it be figured out / reported. Otherwise I love this hack.

    Edit: My bad, no where did the hack author say that spiders were allowed to see, it was me misreading a quoted text. :oops:
  9. borbole

    borbole Well-Known Member

    I didn''t see that the spiders have been defined in xenforo. But maybe I missed it.
  10. David McHenry

    David McHenry Active Member

    exactly. After reading the code, I dont see any where it allows spiders and not members. I think it's just some confusion in this thread.

    Also why would you want spiders to see it and not members? You realize Google cache's what they see and all someone will have to do is visit the cache for that page to view it? Unless of course you disallow Google to cache your pages.

    Also, is there a way to get the total number of replies to the thread, and only show one postbit area message

    "Hello Guest! To see XXX replies to TOPIC TITLE you'll need to be a member and logged in. If you're not a member, register here {register link}, if you are, login at the top of this page!"
  11. joX

    joX Active Member

    I think it is a case of me misinterpreting a quote that had been edited by the 'quoter' and not reading the post that was quoted. Your hack is fine it is my bad.
  12. borbole

    borbole Well-Known Member

    No worries :)
    joX likes this.
  13. Ruven

    Ruven Well-Known Member

    most people dont even know that there is a thing like a google cache
  14. mjp

    mjp Well-Known Member

    This is a good idea. I don't know about the execution here, repeating Hello there guest for every subsequent post, but a good idea.
    erich37 likes this.
  15. Kier

    Kier XenForo Developer Staff Member

    Google is going to be very upset if you show stuff to the spider that is not shown to regular visitors. Showing more content to the spider is just another form of cloaking.
    Forsaken likes this.
  16. dutchbb

    dutchbb Well-Known Member

    If the spiders are seeing more or different things than the unregistered visitors, then it's definitely against Google's policy. If guests see the same as spiders it's ok in that department, but still bad because Google can't index your whole content. Either way, for me, the benefits do not outweigh the costs.

    And I don't want to rain on your parade too much, but if there's one thing on the web that I hate with passion, it's sites that have content indexed in Google, and then make you register or pay to see everything when you find it...

    Sorry, just my opinion :)
  17. Andy.N

    Andy.N Well-Known Member

    I'll leave that site immediately if they want me to register to read. It may increase membership but not the kind of members you want for a long term growth.
    Forsaken likes this.
  18. mjp

    mjp Well-Known Member

    Au contraire Pierre. Those are exactly the kind of users you want for "long term growth," because they care about the topic and want to participate.

    One of the forums I run has all the topics related to the subject open for public view, but the small handful off topic forums are register-to-read. So Google crawls all the relevant forums, but the "community" type conversations are for the community.

    Which records the forum users are listening to, or which movies or TV shows they watch has nothing to do with the subject of the forum so it doesn't have to be indexed by Google. The users like it that way, because they can talk about things they don't necessarily want to show up on Google.
    The8thLegion likes this.
  19. wickedstangs

    wickedstangs Well-Known Member

    wow, this is awesome thank you
    borbole likes this.
  20. Hobblepot

    Hobblepot Member

    Thank You (y)
    borbole likes this.

Share This Page