Show online status

AndreaMarucci

Well-known member
It's possible to avoid the fact that the users deselect the "Show Online Status" checkbox so they'll result invisible to other users?

I would like that all my users show their status online and that nobody has this option...
 
Please note that in my code snippet I had checked="checked" in it...this should be taken out...I have edited my posts above to show this however the quoted posts still have it...simply remove checked="checked" from my code snippet
 
Hi

just to be sure that I understand this correctly:

If I use the code in account_preferences template of ibaker, do I need additionally to implement the code changes Jake suggested in the other 2 templates (account_privacy and navigation_visitor_tab), or do they stay untouched?
 
I used jake's code and the appearance_preferences code from fBaker and now my status is online all the time, even when I'm not...how can I fix this please???

Thanks
 
I'm ok now...I moved my site to another host...thank you for all the help here...I was having all kinds of issues...500 internal server errors, frequent down time, etc...this all came about after my host upgraded Plesk and then updated PHP...this has been going on for over a week and I could not deal with it anymore, so moved the site tonight...was a smooth transition and Mike was very helpful!
 
You can set the default for new users in your:

Admin CP -> Home -> Options -> User Registrations -> Default Registration Values -> Show online status

You can update the preferences of existing users by running this query on your database:

Code:
UPDATE xf_user
SET visible = 1

You can remove the option to change this setting by removing some code from the templates:

Admin CP -> Appearance -> Templates -> account_privacy

Code:
<dl class="ctrlUnit surplusLabel">
<dt><label>{xen:phrase activity_display}:</label></dt>
<dd>
<ul>
<li><label for="ctrl_visible"><input type="checkbox" name="visible" value="1" id="ctrl_visible" class="OptOut" autofocus="autofocus" {xen:checked "{$visitor.visible}"} /> {xen:phrase show_your_online_status}</label> <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p></li>
</ul>
</dd>
</dl>

Admin CP -> Appearance -> Templates -> account_preferences

Code:
<dl class="ctrlUnit">
<dt></dt>
<dd><ul><li><label><input type="checkbox" name="visible" value="1" {xen:checked $visitor.visible} /> {xen:phrase show_your_online_status}</label> <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p></li></ul></dd>
</dl>

Admin CP -> Appearance -> Templates -> navigation_visitor_tab

Code:
<ul class="col1 blockLinksList">
<li>
<form action="{xen:link account/toggle-visibility}" method="post" class="AutoValidator visibilityForm">
<label><input type="checkbox" name="visible" value="1" class="SubmitOnChange" {xen:checked $visitor.visible} />
{xen:phrase show_online_status}</label>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
</li>
</ul>


Can I use the same code in Xenforo 1.2? I was not able to merge thise templates after upgrading, so I guess something changed...
 
Code:
<xen:title>{xen:phrase browsing_preferences}</xen:title>

<xen:require css="account.css" />

<form method="post" class="xenForm _AutoValidator"
    action="{xen:link 'account/preferences-save'}"
    data-fieldValidatorUrl="{xen:link 'account/validate-field.json'}">

    <!--<h3 class="sectionHeader">{xen:phrase appearance}</h3>-->
    <xen:hook name="account_preferences_appearance">
    <xen:if is="{$canChangeStyle}">
        <dl class="ctrlUnit">
            <dt><label for="ctrl_style_id">{xen:phrase style}:</label></dt>
            <dd>
                <select name="style_id" class="textCtrl OptOut" id="ctrl_style_id" autofocus="on">
                    <option value="0">({xen:phrase use_default_style}: {$defaultStyle.title})</option>
                    <optgroup label="{xen:phrase styles}:">
                    <xen:foreach loop="$styles" key="$styleId" value="$style">
                        <xen:if is="{$style.user_selectable} OR {$visitor.is_admin}">
                            <option value="{$styleId}" class="{$style.depthClass}" {xen:selected '{$styleId} == {$visitor.style_id}'}>{$style.depthPrefix}{$style.title}</option>
                        </xen:if>
                    </xen:foreach>
                    </optgroup>
                </select>
                <p class="explain">{xen:phrase you_may_view_site_in_any_of_styles_provided_here}</p>
            </dd>
        </dl>
    <xen:else />
        <input type="hidden" name="style_id" value="{$visitor.style_id}" />
    </xen:if>
    </xen:hook>


    <h3 class="sectionHeader">{xen:phrase locale}</h3>
    <fieldset>
    <xen:hook name="account_preferences_locale">

    <xen:if is="{$canChangeLanguage}">
        <dl class="ctrlUnit">
            <dt><label for="ctrl_language_id">{xen:phrase language}:</label></dt>
            <dd>
                <select name="language_id" class="textCtrl" id="ctrl_language_id">
                    <xen:foreach loop="$languages" key="$languageId" value="$language">
                        <option value="{$languageId}" {xen:selected '{$languageId} == {$visitor.effectiveLanguageId}'}>{$language.title}</option>
                    </xen:foreach>
                </select>
                <p class="explain">{xen:phrase interface_of_site_can_be_displayed_using_any_languages}</p>
            </dd>
        </dl>
    <xen:else />
        <input type="hidden" name="language_id" value="{$visitor.effectiveLanguageId}" />
    </xen:if>

    <dl class="ctrlUnit">
        <dt><label for="ctrl_timezone">{xen:phrase time_zone}:</label></dt>
        <dd>
            <select name="timezone" class="textCtrl" id="ctrl_timezone">
                <xen:foreach loop="$timeZones" key="$identifier" value="$name">
                    <option value="{$identifier}" {xen:selected "{$identifier} == {$visitor.timezone}"}>{$name}</option>
                </xen:foreach>
            </select>
        </dd>
    </dl>
    </xen:hook>
    </fieldset>

    <h3 class="sectionHeader">{xen:phrase options}</h3>

    <xen:hook name="account_preferences_options">
    <dl class="ctrlUnit">
        <dt></dt>
        <dd>
            <ul>
                <li><label><input type="checkbox" name="default_watch_state" value="1" class="Disabler" id="ctrl_default_watch_state" {xen:checked $visitor.default_watch_state} />
                    {xen:phrase automatically_watch_threads_you_create_or_when_you_reply}...</label>
                    <ul id="ctrl_default_watch_state_Disabler">
                        <li><label><input type="checkbox" name="default_watch_state_email" value="1" {xen:checked "{$visitor.default_watch_state} == 'watch_email'"} />
                            {xen:phrase and_receive_email_notifications_of_replies}</label></li>
                    </ul></li>            
                <li><label for="ctrl_enable_rte"><input type="checkbox" name="enable_rte" value="1" id="ctrl_enable_rte" {xen:checked "{$visitor.enable_rte}"} />
                    {xen:phrase use_rich_text_editor_to_create_and_edit_messages}</label></li>            
                <li><label for="ctrl_content_show_signature"><input type="checkbox" name="content_show_signature" value="1" id="ctrl_content_show_signature" {xen:checked "{$visitor.content_show_signature}"} />
                    {xen:phrase show_peoples_signatures_with_their_messages}</label></li>            

<xen:comment> IB added if and changed </xen:comment>
                <xen:if is="{xen:helper ismemberof, $visitor, 3, 4}">
                    <li><label><input type="checkbox" name="visible" value="1" {xen:checked $visitor.visible} />
                        {xen:phrase show_your_online_status}</label>
                        <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p></li>
                <xen:else />
                    <li><input type="hidden" name="visible" value="1" /></li>
                </xen:if>

            </ul>
        </dd>
    </dl>

    <xen:include template="custom_fields_edit" />
    
    </xen:hook>

    <xen:if is="{$xenOptions.enableNotices}">
    <h3 class="sectionHeader">{xen:phrase notices}</h3>

    <dl class="ctrlUnit">
        <dt></dt>
        <dd>
            <ul>
                <li><label><input type="checkbox" name="restore_notices" value="1" />
                    {xen:phrase restore_dismissed_notices}</label>
                    <p class="hint">{xen:phrase restore_dismissed_notices_hint}</p></li>
            </ul>
        </dd>
    </dl>
    </xen:if>

    <dl class="ctrlUnit submitUnit">
        <dt></dt>
        <dd><input type="submit" name="save" value="{xen:phrase save}" accesskey="s" class="button primary" /></dd>
    </dl>

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


I actually meant this code...
 
You can set the default for new users in your:

Admin CP -> Home -> Options -> User Registrations -> Default Registration Values -> Show online status

You can update the preferences of existing users by running this query on your database:

Code:
UPDATE xf_user
SET visible = 1

You can remove the option to change this setting by removing some code from the templates:

Admin CP -> Appearance -> Templates -> account_privacy

Code:
    <dl class="ctrlUnit surplusLabel">
        <dt><label>{xen:phrase activity_display}:</label></dt>
        <dd>
            <ul>
                <li><label for="ctrl_visible"><input type="checkbox" name="visible" value="1" id="ctrl_visible" class="OptOut" autofocus="autofocus" {xen:checked "{$visitor.visible}"} /> {xen:phrase show_your_online_status}</label> <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p></li>
            </ul>
        </dd>
    </dl>

Admin CP -> Appearance -> Templates -> account_preferences

Code:
    <dl class="ctrlUnit">
        <dt></dt>
        <dd><ul><li><label><input type="checkbox" name="visible" value="1" {xen:checked $visitor.visible} /> {xen:phrase show_your_online_status}</label> <p class="hint">{xen:phrase this_will_allow_other_people_to_see_what_page_you_currently_viewing}</p></li></ul></dd>
    </dl>

Admin CP -> Appearance -> Templates -> navigation_visitor_tab

Code:
                <ul class="col1 blockLinksList">
                    <li>               
                        <form action="{xen:link account/toggle-visibility}" method="post" class="AutoValidator visibilityForm">
                            <label><input type="checkbox" name="visible" value="1" class="SubmitOnChange" {xen:checked $visitor.visible} />
                                {xen:phrase show_online_status}</label>
                            <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                        </form>
                    </li>
                </ul>
We have done all of the above steps and everything is looking OK, but within every two or three days, online status of any one user is going to hidden, we searched and checked but didn't find any clue regarding that.

Any idea from any expert?
 
You can update the preferences of existing users by running this query on your database:
Code:
UPDATE xf_user
SET visible = 1
Hi @Jake Bunce
i have some member unchecked their "Show your current activity" option, any query to make this option enable again?
thanks.

Edit. nevermind, working with this code
Code:
UPDATE xf_user
SET activity_visible = 1
 
Last edited:
You can remove the option to change this setting by removing some code from the templates:

Admin CP -> Appearance -> Templates -> account_privacy

(...)

Admin CP -> Appearance -> Templates -> account_preferences

(...)

Admin CP -> Appearance -> Templates -> navigation_visitor_tab

Awesome guide, thanks!

Users of UI.X theme by ThemeHouse will also have to edit template sidePanel__visitorTabs__panels, which is the full-size canvas panel that replaces the visitor tab on mobile devices.
Alternatively, disable the panel under Admin CP -> Appearance -> Styles -> Style Properties -> [UI.X] Canvas Panels.
 
Top Bottom