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

SQL query to set certain options

Discussion in 'XenForo Questions and Support' started by fredrikse, Jan 9, 2013.

  1. fredrikse

    fredrikse Active Member

    Hi,

    I wonder what SQL query I can use to enable all options below, for each and every user?

    setDefaultVaulesForOptions.png
     
  2. fredrikse

    fredrikse Active Member

    Here's another option that I would like to enable and set to "member" with a query:

    messagingPreferences.png
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    For the default watch state:

    Code:
    UPDATE xf_user_option
    SET default_watch_state = 'watch_email';
    
    Or:

    Code:
    UPDATE xf_user_option
    SET default_watch_state = 'watch_no_email';
    
    Depending on if you want emails too. Note that this preference is not retroactive to existing threads.

    For the rich editor:

    Code:
    UPDATE xf_user_option
    SET enable_rte = 1;
    
    For showing signatures:

    Code:
    UPDATE xf_user_option
    SET content_show_signature = 1;
    
    For online status:

    Code:
    UPDATE xf_user
    SET visible = 1;
    
    You can set the default prefs for new users here:

    Admin CP -> Home -> Options -> User Registration -> Default Registration Values
     
    maszd, Eagle, fredrikse and 1 other person like this.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    For "accept conversations":

    Code:
    UPDATE xf_user_privacy
    SET allow_send_personal_conversation = 'members';
    
     
    Eagle, fredrikse and Chris D like this.
  5. fredrikse

    fredrikse Active Member

    Jake, you're the man! :)

    Thanks a lot for your help. This was exactly what I was looking for. This weekend I'm about to migrate my vBulletin forum and my intention is to set a few of these values for all members and then hide them to prevent them from being altered again. Some of these options might come back later on in a different membership package.
     
  6. fredrikse

    fredrikse Active Member

    I just discovered a problem. When I use TMS to control the visibility of certain settings with permission groups it also effects what information is being stored in the database. Those settings that are not visible when I save a visible setting, is not getting stored. How can I handle this?
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You probably want to turn those fields into hidden input fields so their values are still present in the form:

    Code:
    <input type="hidden" name="fieldname" value="value" />
    
     
    fredrikse likes this.
  8. fredrikse

    fredrikse Active Member

    That did it!
    I also added this code to prevent these hidden fields from being active when a user is member of a group that will allow these options to be set:
    Code:
    en:if is="!{xen:helper ismemberof, $visitor, 12}">
    <input type="hidden" name="allow_view_profile" value="members" />
    <input type="hidden" name="allow_post_profile" value="members" />
    <input type="hidden" name="allow_receive_news_feed" value="members" />
    <input type="hidden" name="allow_send_personal_conversation" value="members" />
    <input type="hidden" name="allow_view_identities" value="members" />
    </xen:if>
     

Share This Page