I have a user meta field called "user_status" and another called "user_profile_id". The user profile ID is a unique field which is managed manually. It's a 4 digit number. The user_status field is simply a 1 or 0 if the user is online or not.
I have an XML feed which contains a list of the user_profile_id and their status (1 or 0). I can get the XML in to an array and loop through to display each user_profile_id and it's associated status.
However, I cannot get my head around how to update each user's status in the database. I have an array which looks like this:
//online $users_online Array (  => 1122  => 3678  => 8872 ) //offline $users_offline Array (  => 3342  => 5784 )
I wanted to simply call the WPDB class to do an
"update users set user_status = 1 where user_profile_id IN ($online_array)" sort of statement.
I've looked at the meta_query but that doesn't seem to be what I'm after.
The easiest way would be as I loop through the XML feed results, get that user_profile_id and run an individual update for that user... then move on to the next one. However this is being called every 20 seconds or so and if we have hundreds of users, that's a fair strain on the database!
Does anyone have any thoughts on the best way to process this? I'm at a loss!!