1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 how to hide thread option by css

Discussion in 'Styling and Customization Questions' started by jamalfree, Jul 4, 2015.

  1. jamalfree

    jamalfree Active Member

    hello
    how to hide thread option by css for guest
    thread-option.JPG
     
  2. Amaury

    Amaury Well-Known Member

    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>
     
    jamalfree likes this.
  3. jamalfree

    jamalfree Active Member

    i found easy way extra.css
    #DiscussionListOptionsHandle, .DiscussionListOptions {display: none!important;}
     
  4. James

    James Well-Known Member

    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.
     
    Amaury likes this.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Why would you want to prevent guests from using that anyway?
     
  6. jamalfree

    jamalfree Active Member

    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>
     
  7. James

    James Well-Known Member

    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.
     
  8. jamalfree

    jamalfree Active Member

    it's not Everyone know css ... like you(y)
     

Share This Page