XF 1.4 how to hide thread option by css

Amaury

Well-known member
#2
Template: thread_list

Find:

Code:
<h3 id="DiscussionListOptionsHandle" class="JsOnly"><a href="#">{xen:phrase thread_display_options}</a></h3>

<form action="{xen:link 'forums', $forum}" method="post" class="DiscussionListOptions secondaryContent">

    <xen:hook name="thread_list_options">
    <div class="controlGroup">
        <label for="ctrl_order">{xen:phrase sort_threads_by}:</label>
        <select name="order" id="ctrl_order" class="textCtrl">
            <option value="last_post_date" {xen:selected "{$order} == 'last_post_date'"}>{xen:phrase last_message_time}</option>
            <option value="post_date" {xen:selected "{$order} == 'post_date'"}>{xen:phrase thread_creation_time}</option>
            <option value="title" {xen:selected "{$order} == 'title'"}>{xen:phrase title_alphabetical}</option>
            <option value="reply_count" {xen:selected "{$order} == 'reply_count'"}>{xen:phrase number_of_replies}</option>
            <option value="view_count" {xen:selected "{$order} == 'view_count'"}>{xen:phrase number_of_views}</option>
            <option value="first_post_likes" {xen:selected "{$order} == 'first_post_likes'"}>{xen:phrase first_message_likes}</option>
        </select>
    </div>

    <div class="controlGroup">
        <label for="ctrl_direction">{xen:phrase order_threads_in}:</label>
        <select name="direction" id="ctrl_direction" class="textCtrl">
            <option value="desc" {xen:selected "{$orderDirection} == 'desc'"}>{xen:phrase descending_order}</option>
            <option value="asc" {xen:selected "{$orderDirection} == 'asc'"}>{xen:phrase ascending_order}</option>
        </select>
    </div>
  
    <xen:if is="{$forum.prefixCache}">
        <div class="controlGroup">
            <label for="ctrl_prefix_id">{xen:phrase prefix}:</label>
            <select name="prefix_id" id="ctrl_prefix_id" class="textCtrl">
                <option value="0" {xen:selected '!{$displayConditions.prefix_id}'}>({xen:phrase any})</option>
                <xen:foreach loop="$forum.prefixCache" key="$prefixGroupId" value="$prefixes">
                    <xen:if is="{$prefixGroupId}">
                        <optgroup label="{xen:helper threadPrefixGroup, $prefixGroupId}">
                        <xen:foreach loop="$prefixes" value="$prefixId">
                            <option value="{$prefixId}" {xen:selected '{$displayConditions.prefix_id} == {$prefixId}'}>{xen:helper threadPrefix, $prefixId, escaped, ''}</option>
                        </xen:foreach>
                        </optgroup>
                    <xen:else />
                        <xen:foreach loop="$prefixes" value="$prefixId">
                            <option value="{$prefixId}" {xen:selected '{$displayConditions.prefix_id} == {$prefixId}'}>{xen:helper threadPrefix, $prefixId, escaped, ''}</option>
                        </xen:foreach>
                    </xen:if>
                </xen:foreach>
            </select>
        </div>
    </xen:if>

    <div class="buttonGroup">
        <input type="submit" class="button primary" value="{xen:phrase set_options}" />
        <input type="reset" class="button" value="{xen:phrase cancel}" />
    </div>
    </xen:hook>

    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
Wrap it in this conditional:

Code:
<xen:if is="{$visitor.user_id}"><h3 id="DiscussionListOptionsHandle" class="JsOnly"><a href="#">{xen:phrase thread_display_options}</a></h3>

<form action="{xen:link 'forums', $forum}" method="post" class="DiscussionListOptions secondaryContent">

    <xen:hook name="thread_list_options">
    <div class="controlGroup">
        <label for="ctrl_order">{xen:phrase sort_threads_by}:</label>
        <select name="order" id="ctrl_order" class="textCtrl">
            <option value="last_post_date" {xen:selected "{$order} == 'last_post_date'"}>{xen:phrase last_message_time}</option>
            <option value="post_date" {xen:selected "{$order} == 'post_date'"}>{xen:phrase thread_creation_time}</option>
            <option value="title" {xen:selected "{$order} == 'title'"}>{xen:phrase title_alphabetical}</option>
            <option value="reply_count" {xen:selected "{$order} == 'reply_count'"}>{xen:phrase number_of_replies}</option>
            <option value="view_count" {xen:selected "{$order} == 'view_count'"}>{xen:phrase number_of_views}</option>
            <option value="first_post_likes" {xen:selected "{$order} == 'first_post_likes'"}>{xen:phrase first_message_likes}</option>
        </select>
    </div>

    <div class="controlGroup">
        <label for="ctrl_direction">{xen:phrase order_threads_in}:</label>
        <select name="direction" id="ctrl_direction" class="textCtrl">
            <option value="desc" {xen:selected "{$orderDirection} == 'desc'"}>{xen:phrase descending_order}</option>
            <option value="asc" {xen:selected "{$orderDirection} == 'asc'"}>{xen:phrase ascending_order}</option>
        </select>
    </div>
  
    <xen:if is="{$forum.prefixCache}">
        <div class="controlGroup">
            <label for="ctrl_prefix_id">{xen:phrase prefix}:</label>
            <select name="prefix_id" id="ctrl_prefix_id" class="textCtrl">
                <option value="0" {xen:selected '!{$displayConditions.prefix_id}'}>({xen:phrase any})</option>
                <xen:foreach loop="$forum.prefixCache" key="$prefixGroupId" value="$prefixes">
                    <xen:if is="{$prefixGroupId}">
                        <optgroup label="{xen:helper threadPrefixGroup, $prefixGroupId}">
                        <xen:foreach loop="$prefixes" value="$prefixId">
                            <option value="{$prefixId}" {xen:selected '{$displayConditions.prefix_id} == {$prefixId}'}>{xen:helper threadPrefix, $prefixId, escaped, ''}</option>
                        </xen:foreach>
                        </optgroup>
                    <xen:else />
                        <xen:foreach loop="$prefixes" value="$prefixId">
                            <option value="{$prefixId}" {xen:selected '{$displayConditions.prefix_id} == {$prefixId}'}>{xen:helper threadPrefix, $prefixId, escaped, ''}</option>
                        </xen:foreach>
                    </xen:if>
                </xen:foreach>
            </select>
        </div>
    </xen:if>

    <div class="buttonGroup">
        <input type="submit" class="button primary" value="{xen:phrase set_options}" />
        <input type="reset" class="button" value="{xen:phrase cancel}" />
    </div>
    </xen:hook>

    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form></xen:if>
 

James

Well-known member
#4
i found easy way extra.css
#DiscussionListOptionsHandle, .DiscussionListOptions {display: none!important;}
Unless you wrapped this CSS code in a conditional you'll hide it from everyone.

If you did wrap it in a conditional then you might as well have wrapped the template in a conditional because hiding things with CSS can be shown again using any browser's element inspector.
 

jamalfree

Active member
#6
Unless you wrapped this CSS code in a conditional you'll hide it from everyone.

If you did wrap it in a conditional then you might as well have wrapped the template in a conditional because hiding things with CSS can be shown again using any browser's element inspector.
for me i want only hide for guests, its work fine!!!
PAGE_CONTAINER
<xen:if is="!{$visitor.user_id}">

<style>
#DiscussionListOptionsHandle, .DiscussionListOptions {display: none!important;}
</style>
</xen:if>
 

James

Well-known member
#7
for me i want only hide for guests, its work fine!!!
PAGE_CONTAINER
<xen:if is="!{$visitor.user_id}">

<style>
#DiscussionListOptionsHandle, .DiscussionListOptions {display: none!important;}
</style>
</xen:if>
That's fair enough but as I said a bit of your website's source inspection can undo that. Admittedly most won't bother to do it but it's there.
 
Top