XF 1.5 I need a query for some users

Arno Nühm

Active member
I have a premium usergroup where users can choose to be invisible in the forum. But if they leave this group they can still be invisible.

I would like to run a query to set all users who are not in usergroup 'X' to be visible in the forum.

Is there any MySQL-Guru who can help me? :)
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:

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

    <dl class="ctrlUnit surplusLabel">
        <dt><label>{xen:phrase activity_display}:</label></dt>
                <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>

Admin CP -> Appearance -> Templates -> account_preferences

    <dl class="ctrlUnit">
        <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>

Admin CP -> Appearance -> Templates -> navigation_visitor_tab

                <ul class="col1 blockLinksList">
                        <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}" />
You'll need a "where" clause in the above to say usergroup X but it'll work.

What you're probably best off doing is getting an addon created so that when a user is downgraded it sets their status to visible automatically.
Top Bottom