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

XF 1.5 I need a query for some users

Arno Nühm

Active member
#1
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? :)
 

James

Well-known member
#2
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>
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.