1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

美化 Guests See First Post Only

本帖由 admin2012-02-23 发布。版面名称:XenForo中文版

  1. admin

    admin 管理员 管理成员

    注册:
    2011-11-01
    帖子:
    3,671
    赞:
    2,425
    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:
    PHP:
    <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="$messageto="$user/>
        </
    xen:include>
        <
    div class="messageInfo">
            <
    br /><br />
          <
    xen:if is="!{$visitor.user_id} && !{$post.isFirst}">
          <
    class="importantMessage">Hello there guestPlease <a href="{xen:link 'register/'}">Register</a> or <a href="{xen:link 'login/'}">login</ato 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>
     
正在加载...