1. Приветствуем Вас на неофициальном форуме технической поддержки XenForo на русском языке. XenForo - коммерческий форумный движок от бывших создателей vBulletin, написанный на PHP.

1.1.x First Post on All Pages [RU]

Тема в разделе "Made in XF-Russia.ru", создана пользователем GiveMeABreak, 19.10.2010.

Загрузка
  1. infis

    infis Местный

    Регистрация:
    27.06.11
    Сообщения:
    5 966
    Симпатии:
    3 548
    Версия XF:
    1.5.9
    Я выложил другой вариант закрепления первого поста в теме. Попробуйте его, он поудачнее будет, да и вроде без косяков.
     
  2. Sergey_M

    Sergey_M Местный

    Регистрация:
    19.02.13
    Сообщения:
    20
    Симпатии:
    10
    Версия XF:
    1.2.2
    GiveMeABreak, спасибо - плагин поставил, отлично работает на 2-х форумах! :thumbsup:
     
  3. Suzen

    Suzen Местный

    Регистрация:
    21.02.11
    Сообщения:
    49
    Симпатии:
    19
    Версия XF:
    1.2.0
    Версия Ксена 1.2, в меню Опции темы, пропала кнопка закрепления первого поста, но темы закрепленные ранее, так и остаются первыми, после активации этого дополнения.
     
  4. infis

    infis Местный

    Регистрация:
    27.06.11
    Сообщения:
    5 966
    Симпатии:
    3 548
    Версия XF:
    1.5.9
    Если не ошибаюсь, то там была правка шаблона через TMS. А при обновлении движка до 1.2, вероятно, нужно опять эту правку внести. Иначе как раз и не отображается кнопка.
     
  5. Suzen

    Suzen Местный

    Регистрация:
    21.02.11
    Сообщения:
    49
    Симпатии:
    19
    Версия XF:
    1.2.0
    infis, да нет и без TMS работало, изменений не вносил, а тут..
     
  6. infis

    infis Местный

    Регистрация:
    27.06.11
    Сообщения:
    5 966
    Симпатии:
    3 548
    Версия XF:
    1.5.9
    Вот поэтому я и предполагаю, что проблема с шаблоном. И скорее всего с TMS, если кроме перехода на 1.2 ничего не менялось.
     
  7. wagamata

    wagamata Местный

    Регистрация:
    07.05.13
    Сообщения:
    135
    Симпатии:
    13
    Версия XF:
    1.3.2
    Как поправить то?
     
  8. Suzen

    Suzen Местный

    Регистрация:
    21.02.11
    Сообщения:
    49
    Симпатии:
    19
    Версия XF:
    1.2.0
    @wagamata
    Сначала сделай бэкап шаблона thread_view. Затем замени его содержимое на:
    Код:
    <xen:title>{xen:helper threadPrefix, $thread, escaped}{$thread.title}{xen:helper pagenumber, $page}</xen:title>
    <xen:h1>{xen:helper threadPrefix, $thread}{$thread.title}</xen:h1>
    
    <xen:description>
        {xen:phrase discussion_in_x_started_by_y_date_z,
            'forum=<a href="{xen:link forums, $forum}">{$forum.title}</a>',
            'name={xen:helper username, $thread}',
            'date=<a href="{xen:link threads, $thread}">{xen:datetime $thread.post_date, html}</a>'}
    </xen:description>
    
    <xen:navigation>
        <xen:breadcrumb source="$nodeBreadCrumbs" />
    </xen:navigation>
    
    <xen:container var="$head.canonical">
        <link rel="canonical" href="{xen:link 'canonical:threads', $thread, 'page={$page}'}" /></xen:container>
    <xen:container var="$head.description">
        <meta name="description" content="{xen:helper snippet, $firstPost.message, 155}" /></xen:container>
    <xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>
            <xen:set var="$title">{xen:helper threadPrefix, $thread, escaped}{$thread.title}</xen:set>
            <xen:set var="$avatar">{xen:helper avatar, $thread, m, 0, 1}</xen:set>
        </xen:include></xen:container>
    <xen:container var="$bodyClasses">{xen:helper nodeClasses, $nodeBreadCrumbs, $forum}</xen:container>
    <xen:container var="$searchBar.thread"><xen:include template="search_bar_thread_only" /></xen:container>
    <xen:container var="$searchBar.forum"><xen:include template="search_bar_forum_only" /></xen:container>
    
    <xen:if is="{$canReply}">
        <xen:comment><xen:topctrl>
            <a href="{xen:link 'threads/reply', $thread}" class="callToAction"><span>{xen:phrase reply_to_thread}</span></a>
        </xen:topctrl></xen:comment>
    </xen:if>
    
    <xen:require css="thread_view.css" />
    
    <xen:edithint template="message" />
    
    <xen:if is="{$poll}">
        <xen:include template="poll_block">
            <xen:set var="$options">
                <xen:if is="{$poll.canVote}">
                    <xen:include template="poll_block_vote" />
                <xen:else />
                    <xen:include template="poll_block_result" />
                </xen:if>
            </xen:set>
        </xen:include>
    </xen:if>
    
    <xen:if is="{$showPostedNotice}">
        <div class="importantMessage">{xen:phrase message_submitted_displayed_pending_approval}</div>
    </xen:if>
    
    <xen:set var="$threadStatusHtml">
        <xen:if hascontent="true">
            <dl class="threadAlerts secondaryContent">
                <dt>{xen:phrase thread_status}:</dt>
                <xen:contentcheck>
                    <xen:if is="{$thread.discussion_state} == 'deleted'">
                        <dd class="deletedAlert">
                            <span class="icon Tooltip" title="{xen:phrase deleted}" data-tipclass="iconTip"></span>
                                {xen:phrase removed_from_public_view}</dd>
                    <xen:elseif is="{$thread.discussion_state} == 'moderated'" />
                        <dd class="moderatedAlert">
                            <span class="icon Tooltip" title="{xen:phrase awaiting_moderation}" data-tipclass="iconTip"></span>
                                {xen:phrase awaiting_moderation_before_being_displayed_publicly}</dd>
                    </xen:if>
      
                    <xen:if is="!{$thread.discussion_open}">
                        <dd class="lockedAlert">
                            <span class="icon Tooltip" title="{xen:phrase locked}" data-tipclass="iconTip"></span>
                                {xen:phrase not_open_for_further_replies}</dd>
                    </xen:if>
                </xen:contentcheck>
            </dl>
        </xen:if>
    </xen:set>
    {xen:raw $threadStatusHtml}
    
    <xen:hook name="thread_view_pagenav_before" params="{xen:array 'thread={$thread}'}" />
    
    <div class="pageNavLinkGroup">
        <div class="linkGroup SelectionCountContainer">
            <xen:if hascontent="true">
                <div class="Popup">
                    <a rel="Menu">{xen:phrase thread_tools}</a>
                    <div class="Menu">
                    <xen:contentcheck>
                        <xen:if hascontent="true">
                        <div class="primaryContent menuHeader"><h3>{xen:phrase thread_tools}</h3></div>
                        <ul class="secondaryContent blockLinksList">
                            <xen:contentcheck>
                                <xen:if is="{$canEditThread}">
                                    <li><a href="{xen:link 'threads/edit', $thread}" class="OverlayTrigger">{xen:phrase edit_thread}</a></li>
                                <xen:elseif is="{$canEditTitle}" />
                                    <li><a href="{xen:link threads/edit-title, $thread}" class="OverlayTrigger">{xen:phrase edit_title}</a></li>
                                </xen:if>
                                <xen:if is="{$canDeleteThread}">
                                    <li><a href="{xen:link 'threads/delete', $thread}" class="OverlayTrigger">{xen:phrase delete_thread}</a></li>
                                </xen:if>
                                <xen:if is="{$canMoveThread}">
                                    <li><a href="{xen:link 'threads/move', $thread}" class="OverlayTrigger">{xen:phrase move_thread}</a></li>
                                </xen:if>
                                <xen:if is="{$deletedPosts}">
                                    <li><a href="{xen:link threads/show-posts, $thread, 'page={$page}'}" class="MessageLoader" data-messageSelector="#messageList .message.deleted.placeholder">{xen:phrase show_deleted_posts}</a></li>
                                </xen:if>
                                <xen:hook name="thread_view_tools_links" params="{xen:array 'thread={$thread}'}" />
                            </xen:contentcheck>
                        </ul>
                        </xen:if>
                        <xen:if hascontent="true">
                        <form action="{xen:link threads/quick-update, $thread}" method="post" class="AutoValidator">
                            <ul class="secondaryContent blockLinksList checkboxColumns">
                            <xen:contentcheck>
                                <xen:if is="{$canLockUnlockThread}">
                                <li><label><input type="checkbox" name="discussion_open" value="1" class="SubmitOnChange" {xen:checked $thread.discussion_open} />
                                    {xen:phrase open_thread}</label>
                                    <input type="hidden" name="set[discussion_open]" value="1" /></li></xen:if>
                                <xen:if is="{$canStickUnstickThread}">
                                <li><label><input type="checkbox" name="sticky" value="1" class="SubmitOnChange" {xen:checked $thread.sticky} />
                                    {xen:phrase sticky}</label>
                                    <input type="hidden" name="set[sticky]" value="1" /></li></xen:if>
                            </xen:contentcheck>
                            </ul>
                            <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                        </form>
                        </xen:if>
                        <xen:if is="{$thread.canInlineMod}">
                        <form action="{xen:link inline-mod/thread/switch}" method="post" class="InlineModForm sectionFooter" id="threadViewThreadCheck"
                            data-cookieName="threads">
                            <label><input type="checkbox" name="threads[]" value="{$thread.thread_id}" class="InlineModCheck" /> {xen:phrase select_for_thread_moderation}</label>
                            <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                        </form>
                        </xen:if>
                        <xen:if is="{$canMoveThread}">
                        <form action="{xen:link threads/sticky-first-post, $thread, 'page={$page}'}" method="post" class="AutoValidator visibilityForm sectionFooter">
                                <label><input type="checkbox" name="firstpoststicked" value="1" class="SubmitOnChange" <xen:if is="{$thread.firstpoststicked} == 1">checked="checked"</xen:if>/>
                                    {xen:phrase sticky_first_post}</label>
    
                                <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                        </form>
                                            </xen:if>
                    </xen:contentcheck>
                    </div>
                </div>
            </xen:if>
            <xen:if is="{$canWatchThread}">
                <a href="{xen:link 'threads/watch-confirm', $thread}" class="OverlayTrigger" data-cacheOverlay="false">{xen:if $thread.thread_is_watched, '{xen:phrase unwatch_thread}', '{xen:phrase watch_thread}'}</a>
            </xen:if>
        </div>
    
        <xen:pagenav link="threads" linkdata="{$thread}"
            page="{$page}" perpage="{$postsPerPage}" total="{$totalPosts}"
            unreadlink="{$unreadLink}" />
    </div>
    
    <xen:include template="ad_thread_view_above_messages" />
    
    <xen:hook name="thread_view_form_before" params="{xen:array 'thread={$thread}'}" />
    
    <form action="{xen:link 'inline-mod/post/switch'}" method="post"
        class="InlineModForm section"
        data-cookieName="posts"
        data-controls="#InlineModControls"
        data-imodOptions="#ModerationSelect option">
    
        <ol class="messageList" id="messageList">
            <xen:foreach loop="$posts" value="$post">
                <xen:if is="{$post.message_state} == 'deleted'">
                    <xen:include template="post_deleted_placeholder" />
                <xen:else />
                    <xen:include template="post" />
                </xen:if>
            </xen:foreach>
            <xen:edithint template="attached_files" />
        </ol>
    
        <xen:if is="{$inlineModOptions}">
            <div class="sectionFooter InlineMod Hide">
                <label for="ModerationSelect">{xen:phrase perform_action_with_selected_posts}...</label>
    
                <xen:include template="inline_mod_controls">
                    <xen:set var="$text">{xen:phrase post_moderation}</xen:set>
                    <xen:set var="$options">
                        <xen:if is="{$inlineModOptions.delete}"><option value="delete">{xen:phrase delete_posts}...</option></xen:if>
                        <xen:if is="{$inlineModOptions.undelete}"><option value="undelete">{xen:phrase undelete_posts}</option></xen:if>
                        <xen:if is="{$inlineModOptions.approve}"><option value="approve">{xen:phrase approve_posts}</option></xen:if>
                        <xen:if is="{$inlineModOptions.unapprove}"><option value="unapprove">{xen:phrase unapprove_posts}</option></xen:if>
                        <xen:if is="{$inlineModOptions.move}"><option value="move">{xen:phrase move_posts}...</option></xen:if>
                        <xen:if is="{$inlineModOptions.merge}"><option value="merge">{xen:phrase merge_posts}...</option></xen:if>
                        <option value="deselect">{xen:phrase deselect_posts}</option>
                    </xen:set>
                    <xen:set var="$checkboxTitle">{xen:phrase select_deselect_all_posts_on_this_page}</xen:set>
                    <xen:set var="$selectedItemsPhrase">{xen:phrase selected_posts}</xen:set>
                </xen:include>
            </div>
        </xen:if>
    
        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    
    </form>
    
    <xen:if hascontent="true">
        <div class="pageNavLinkGroup">
            <xen:contentcheck>
                <xen:if is="{$canQuickReply}">
                    <xen:if is="{$postsRemaining}">
                        <div class="linkGroup">
                            <xen:if is="{$postsRemaining} == 1">
                                <a href="{xen:link threads, $thread, 'page={xen:calc "{$page} + 1"}'}" class="postsRemaining">{xen:phrase 1_more_message}...</a>
                            <xen:else />
                                <a href="{xen:link threads, $thread, 'page={xen:calc "{$page} + 1"}'}" class="postsRemaining">{xen:phrase x_more_messages, 'count={xen:number $postsRemaining}'}...</a>
                            </xen:if>
                        </div>
                    </xen:if>
                <xen:else />
                    <div class="linkGroup">
                        <xen:if is="{$canReply}">
                            <a href="{xen:link 'threads/reply', $thread}" class="callToAction"><span>{xen:phrase reply_to_thread}</span></a>
                        <xen:elseif is="{$visitor.user_id}" />
                            <span class="element">({xen:phrase no_permission_to_reply})</span>
                        <xen:else />
                            <label for="LoginControl"><a href="{xen:link login}" class="concealed element">({xen:phrase log_in_or_sign_up_to_reply})</a></label>
                        </xen:if>
                    </div>
                </xen:if>
                <div class="linkGroup"{xen:if '!{$ignoredNames}', ' style="display: none"'}><a href="javascript:" class="muted jsOnly DisplayIgnoredContent Tooltip" title="{xen:phrase show_hidden_content_by_x, "names={xen:helper implode, $ignoredNames, ', '}"}">{xen:phrase show_ignored_content}</a></div>
    
                <xen:pagenav link="threads" linkdata="{$thread}"
                    page="{$page}" perpage="{$postsPerPage}" total="{$totalPosts}"
                    unreadlink="{$unreadLink}"
                />
            </xen:contentcheck>
        </div>
    </xen:if>
    
    <xen:include template="ad_thread_view_below_messages" />
    
    <xen:hook name="thread_view_qr_before" params="{xen:array 'thread={$thread}'}" />
    
    <xen:if is="{$canQuickReply}">
        <xen:include template="quick_reply">
            <xen:set var="$formAction">{xen:link 'threads/add-reply', $thread}</xen:set>
            <xen:set var="$lastDate">{$lastPost.post_date}</xen:set>
            <xen:set var="$lastKnownDate">{$thread.last_post_date}</xen:set>
            <xen:set var="$showMoreOptions">1</xen:set>
        </xen:include>
    </xen:if>
    
    <xen:hook name="thread_view_qr_after" params="{xen:array 'thread={$thread}'}" />
    
    {xen:raw $threadStatusHtml}
    
    <xen:include template="share_page">
        <xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>
    </xen:include>
    Всё должно встать на свои места.
     
    Mirovinger и wagamata нравится это.
  9. wagamata

    wagamata Местный

    Регистрация:
    07.05.13
    Сообщения:
    135
    Симпатии:
    13
    Версия XF:
    1.3.2
    Заработало. Только вот насколько это безопасно? Нельзя ли просто выложить конкретные строчки, которые нужно вставить/заменить?
     
  10. Suzen

    Suzen Местный

    Регистрация:
    21.02.11
    Сообщения:
    49
    Симпатии:
    19
    Версия XF:
    1.2.0
    Элементарно, открыть бэкап и сравнить с изменённым шаблоном, строчки найдутся. ;)
     
    resonansER и Mirovinger нравится это.
  11. KVik

    KVik Пользователь

    Регистрация:
    23.01.14
    Сообщения:
    8
    Симпатии:
    2
    Версия XF:
    1.3.0
    Если установлен плагин, удалить.

    Перед установкой:
    В "Install.php" изменить строки
    PHP:
        protected function _installVersion1()
        {
                    
    $this->_getDb();

                    
    $this->_db->query("ALTER TABLE `xf_thread` ADD `firstpoststicked` INT( 10 ) NOT NULL DEFAULT '0'");
        }

        protected function 
    _installVersion2()
        {
                    
    $this->_getDb();

                    
    $this->_db->query("ALTER TABLE `xf_thread` CHANGE `firstpoststicked` `firstpoststicked` INT( 10 ) NOT NULL DEFAULT '0'");
        }
    на
    PHP:
        protected function _installVersion1()
        {
                    
    $this->_getDb();

                    
    $this->_db->query("ALTER TABLE `xf_thread` ADD `firstpoststicked` INT( 10 ) NOT NULL DEFAULT '1'");
        }

        protected function 
    _installVersion2()
        {
                    
    $this->_getDb();

                    
    $this->_db->query("ALTER TABLE `xf_thread` CHANGE `firstpoststicked` `firstpoststicked` INT( 10 ) NOT NULL DEFAULT '1'");
        }
    Установить плагин.
     
    Mirovinger нравится это.
  12. Nolik

    Nolik Местный

    Регистрация:
    13.10.10
    Сообщения:
    169
    Симпатии:
    56
    Версия XF:
    1.1.3
    А а 1.4 не появился такой функционал? Для 1.4 нормальное рабочее решение никто не использует?
     
  13. softyes

    softyes Активный пользователь

    Регистрация:
    19.06.14
    Сообщения:
    1
    Симпатии:
    0
    Версия XF:
    1.4.2
    Плагин Sticky First Post прекрасно и без проблем справляется с этой функцией, протестировано на 1.4.2
     
  14. KakBeOlolo

    KakBeOlolo Местный

    Регистрация:
    08.10.11
    Сообщения:
    510
    Симпатии:
    93
    Версия XF:
    1.1.2
    Все пашет, но я заметил баг:
    Если закрепить первый пост, а потом не обновляя страницу открепить, то надпись сверху будет такая же, что и при закреплении
     
  15. AvCrash

    AvCrash Местный

    Регистрация:
    09.07.12
    Сообщения:
    122
    Симпатии:
    17
    Версия XF:
    1.3.2
    Скажите, корректно ли работает плагин с 1.4.х?
     
  16. infis

    infis Местный

    Регистрация:
    27.06.11
    Сообщения:
    5 966
    Симпатии:
    3 548
    Версия XF:
    1.5.9
    Я использую Sticky Fist Post. На 1.4.4 работает.
     
  17. AvCrash

    AvCrash Местный

    Регистрация:
    09.07.12
    Сообщения:
    122
    Симпатии:
    17
    Версия XF:
    1.3.2
    Понял. Спасибо. Правду ли пишут, что RAID101 содержит коллбэки?
     
  18. infis

    infis Местный

    Регистрация:
    27.06.11
    Сообщения:
    5 966
    Симпатии:
    3 548
    Версия XF:
    1.5.9
    Без понятия. В этом плагине вроде ничего лишнего нет.
     
    AvCrash нравится это.

Поделиться этой страницей