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

Add-on First Post Only

Discussion in 'Resource and Add-on Requests' started by Inkman, Jul 26, 2013.

  1. Inkman

    Inkman Active Member

    Can anyone please create an add-on so guests can only read the first post of every thread.
    I have seen other members requesting this but people just tell them to add a code here and there but i would like an add-on that would do this for you like vbulletin has.

    It would be good that other posts under the first post has a sentence which says something like "to view other posts please register" or something along them lines.

    Thanks in advance...
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    These instructions are for the template message...

    Find:
    Code:
        <div class="messageInfo primaryContent">
    
    Immediately after add:
    Code:
        <xen:if is="{$post.position} != 0 AND {$visitor.user_id} > 0">
    
    Find:
    Code:
        </div>
    
        <xen:hook name="message_below" params="{xen:array 'post={$message}','message_id={$messageId}'}" />
    
    Immediately before add:
    Code:
        <xen:else />
    <label for="LoginControl"><a href="{xen:link login}">Please log in or sign up to view this post.</a></label>
    </xen:if>
    
    Will restrict viewing of non-posts and open the form when clicked.
     
  3. Inkman

    Inkman Active Member

    Thanks for your reply @King Kovifor Like i said above i didn't really want want a code, i wanted an addon to do this, the reason why is because i couldn turn it on and off quickly with that.
    But seeing as i had no other replies i have just tried the code and its hiding the first post only from myself (admin) and i presume other usergroups. :(

    What i need it to do is to show the first post only of every thread to guests and all other posts hidden with a login or register notice.
    Hope you can help, thanks again.
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Hm, that shouldn't be happening. I'll recheck my code tonight (I can even walk you through adding an option to turn it on/off).
     
    Inkman likes this.
  5. Jon W

    Jon W Well-Known Member

    http://xenforo.com/community/resources/guests-first-post-only-by-waindigo.2143/
     
    Inkman and Rob like this.
  6. Inkman

    Inkman Active Member

    Thank you so much @Waindigo i really appreciate it :) It works perfect.
     
    Jon W and Rob like this.

Share This Page