Announcement

Collapse
No announcement yet.

Query for setting profile field answer to all users if none exists?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] Query for setting profile field answer to all users if none exists?

    Hi,

    I have a dropdown selection on my forum with three options.

    'None' is the default, and new registrations are being given it. The other two options only come when they validate their purchase (which is seperate from this issue).

    Basically what I need to do, is force the 'None' setting onto users which existed before the profile field did (and therefore have no setting selected at all).

    Is this possible?

    Basically if they have blank, give them 'None'.

    Thanks!

  • #2
    Originally posted by Tim Wheatley View Post
    Hi,

    I have a dropdown selection on my forum with three options.

    'None' is the default, and new registrations are being given it. The other two options only come when they validate their purchase (which is seperate from this issue).

    Basically what I need to do, is force the 'None' setting onto users which existed before the profile field did (and therefore have no setting selected at all).

    Is this possible?

    Basically if they have blank, give them 'None'.

    Thanks!
    Backup your database before running any queries supplied!

    Now you can try:

    PHP Code:
    UPDATE user LEFT JOIN userfield
    ON user
    .userid userfield.userid
    SET field4 
    'None'
    WHERE field4 IS NULL OR field4 '' 
    Replace field4 i.e. the # 4 w/ the field number of your profile field.


    Former vBulletin Support Staff
    Hacked recently? See my blog post "Recovering a Hacked vBulletin Site".
    Thinking outside the box? Need modification support? Visit www.vBulletin.org and have at it!

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X