Resource icon

[tl] Thread Sticky Timer [Paid] 2.0.0

No permission to buy ($15.00)
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:
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.webp

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:
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>
That has been fixed now.
 
Hi @truonglv I'm interested in this Sticky Thread timer.

I would like to allow users to make sticky threads for a certain period e.g. 1 day or 1 week. I would also like to allow Admins/Moderators to keep their sticky threads up forever. Does this add-on allow me to make the difference between regular user (temp sticky thread) and elevated permission user (forever sticky thread)? Thank you!
 
Top Bottom