XF 2.0 Disabling show online status option

Alternadiv

Well-known member
I thought I have disabled the ability for users to hide their online status by removing this option from the templates it is in. However, about 1 in 10 new members find a way to make themselves invisible. I tried making a test account to see where they are seeing this option, but I cannot find it. Is there a template I missed? How are they still doing this?
 
You also need to remove the option from the account_preferences template.
I believe I have removed it from both templates already. Maybe I missed it?

Code:
<xf:title>{{ phrase('preferences') }}</xf:title>

<xf:wrap template="account_wrapper" />

<xf:form action="{{ link('account/preferences') }}" ajax="true" class="block" data-force-flash-message="true">
    <div class="block-container">
        <div class="block-body">
            <xf:if is="$xf.visitor.canChangeStyle()">

                <xf:selectrow name="user[style_id]" value="{$xf.visitor.style_id}"
                    label="{{ phrase('style') }}">

                    <xf:option value="0">{{ phrase('use_default_style:') }} {$defaultStyle.title}</xf:option>
                    <xf:optgroup label="{{ phrase('styles:') }}">
                        <xf:foreach loop="$styles" value="$style">
                            <xf:option value="{$style.style_id}">{{ repeat('--', $style.depth) }} {$style.title}{{ !$style.user_selectable ? ' *' : '' }}</xf:option>
                        </xf:foreach>
                    </xf:optgroup>
                </xf:selectrow>
            <xf:else />
                <xf:hiddenval name="user[style_id]">{$xf.visitor.style_id}</xf:hiddenval>
            </xf:if>

            <xf:if is="$xf.visitor.canChangeLanguage()">
                <xf:selectrow name="user[language_id]" value="{$xf.visitor.language_id}"
                    label="{{ phrase('language') }}">

                    <xf:foreach loop="$languageTree.getFlattened(0)" value="$treeEntry">

Code:
<xf:title>{{ phrase('privacy') }}</xf:title>

<xf:wrap template="account_wrapper" />

<xf:form action="{{ link('account/privacy') }}" ajax="true" class="block" data-force-flash-message="true">
    <div class="block-container">
        <div class="block-body">
            
            <xf:macro template="helper_account" name="dob_privacy_row" />

            <xf:formrow rowtype="inputLabelPair noColon"
                label="{{ phrase('allow_users_to...') }}">

                <xf:macro name="privacy_option"
                    arg-user="{$xf.visitor}"
                    arg-name="allow_view_profile"
                    arg-label="{{ phrase('view_your_details_on_your_profile_page:') }}" />

                <xf:if is="$xf.visitor.canViewProfilePosts()">
                    <xf:macro name="privacy_option"
                        arg-user="{$xf.visitor}"
                        arg-name="allow_post_profile"
                        arg-label="{{ phrase('post_messages_on_your_profile_page:') }}"
                        arg-hideEveryone="{{true}}" />
                </xf:if>

                <xf:if is="$xf.options.enableNewsFeed">
                    <xf:macro name="privacy_option"
 
Is it not bizarre that 1 in 10 new members are still going invisible after they register? There must be something I missed. I’m surprised this isn’t a regular settting.
 
I've asked a few of them and they say they aren't even sure what that setting is, which adds to my confusing. Yes, they post on the site and are real people and not bots.
 
However, about 1 in 10 new members find a way to make themselves invisible.

I think I know why this is happening.

When you remove a control from the page, absence of the control is treated as a negative value next time the form is submitted and processed.

So, if your form does not have user[visible] checkbox, and user decides to change some other option (for example, "don't show date of birth"), user[visible] will be set to 0, so the user will make himself invisible. Even though he was changing the date of birth option.

I think if you are taking checkboxes off, you need to replace them with hidden inputs with value of 1 like this

HTML:
<input type="hidden" name="user[visible]" value="1">
<input type="hidden" name="user[activity_visible]" value="1">
 
I think I know why this is happening.

When you remove a control from the page, absence of the control is treated as a negative value next time the form is submitted and processed.

So, if your form does not have user[visible] checkbox, and user decides to change some other option (for example, "don't show date of birth"), user[visible] will be set to 0, so the user will make himself invisible. Even though he was changing the date of birth option.

I think if you are taking checkboxes off, you need to replace them with hidden inputs with value of 1 like this

HTML:
<input type="hidden" name="user[visible]" value="1">
<input type="hidden" name="user[activity_visible]" value="1">
Thank you!!!

You’re probably right because these members always say they didn’t set them self invisible. And I noticed they often DID change some other option. I will have to implement this and wait a few weeks to see if the problem went away.
 
I think I know why this is happening.

When you remove a control from the page, absence of the control is treated as a negative value next time the form is submitted and processed.

So, if your form does not have user[visible] checkbox, and user decides to change some other option (for example, "don't show date of birth"), user[visible] will be set to 0, so the user will make himself invisible. Even though he was changing the date of birth option.

I think if you are taking checkboxes off, you need to replace them with hidden inputs with value of 1 like this

HTML:
<input type="hidden" name="user[visible]" value="1">
<input type="hidden" name="user[activity_visible]" value="1">
In comparison to the original, unedited code, how do I implement this? By replacing the lines for the option? Is it this line?:
Code:
<xf:macro template="helper_account" name="activity_privacy_row" />
 
First, make sure that the way it is right now the visibility option is getting unset when you modify some other option on the form with your modification applied.

Then you need to replace this line

HTML:
<xf:macro template="helper_account" name="activity_privacy_row" />

for these two lines

HTML:
<input type="hidden" name="user[visible]" value="1">
<input type="hidden" name="user[activity_visible]" value="1">

Then repeat the previous experiment: try to modify some other option and make sure that user[visible] is not getting unset.
 
Last edited:
Top Bottom