Resource icon

[tl] Thread Sticky Timer 1.0.0

No permission to download

Nerdface

Well-known member
I really like the concept, but I have a slight bug to report..

The "Unstick thread" moderator option no longer appears inside sticky threads (thread view), and remains as "Stick thread".


--EDIT--
Here's the fix - Replace the TST_replaceQuickStick template modification with:
Code:
<xf:set var="$isEnableNode"><xf:callback class="Truonglv\StickyTimer\Listener"
                                             method="isEnableNode">{$thread.node_id}</xf:callback></xf:set>
<xf:if is="$isEnableNode is not empty">
    <xf:if is="$thread.canStickUnstick()">
        <xf:if is="$thread.sticky">
            <a href="{{ link('threads/quick-stick', $thread) }}"
                class="menu-linkRow"
                data-xf-click="switch"
                data-menu-closer="true">
                {{ phrase('unstick_thread') }}
        <xf:else />
            <a href="{{ link('threads/sticky-timer', $thread) }}"
               class="menu-linkRow"
               data-xf-click="overlay">
               {{ phrase('stick_thread') }}
            </a>
        </xf:if>
    </xf:if>
<xf:else />
    $0
</xf:if>
 
Last edited:

Nerdface

Well-known member
There's still a slight issue with the Stick/Unstick switch using the above solution.

It can be fixed with Javascript to refresh the page, but it's probably not the best way to do it.. @truonglv any thoughts?

Code:
<xf:set var="$isEnableNode"><xf:callback class="Truonglv\StickyTimer\Listener"
                                             method="isEnableNode">{$thread.node_id}</xf:callback></xf:set>
<xf:if is="$isEnableNode is not empty">
    <xf:if is="$thread.canStickUnstick()">
        <xf:if is="$thread.sticky">
            <a href="{{ link('threads/quick-stick', $thread) }}"
                class="menu-linkRow"
                data-xf-click="switch"
                data-menu-closer="true"
                onclick="refreshMe = setTimeout(function () {
                    window.location.reload();
                }, 2500);">
                {{ phrase('unstick_thread') }}
             </a>
        <xf:else />
            <a href="{{ link('threads/sticky-timer', $thread) }}"
               class="menu-linkRow"
               data-xf-click="overlay">
               {{ phrase('stick_thread') }}
            </a>
            <script type="text/javascript">
               clearTimeout(refreshMe);
            </script>
        </xf:if>
    </xf:if>
<xf:else />
    $0
</xf:if>
(I posted a similar reply about 30 minutes ago, but the Javascript was buggy which I have since fixed).


--EDIT--
Another change I've made is to show the time as well as date that the timer expires.
sticky-timer.jpg

Code:
            {{ phrase('tl_sticky_timer.this_thread_has_been_sticked_and_be_remove_at_x', {
                'date': '<strong>' . date($thread.StickyTimer.expire_date) . ' at ' . time($thread.StickyTimer.expire_date) . '</strong>'
            }) }}
 
Last edited:
Top