I am coding a plugin that saves some metadata to the currently logged in user. I am using the function update_user_meta. I have noticed the following behavior:
update_user_meta($uid, "mykey", "myvalue") => returns True for success
update_user_meta($uid, "mykey", "myvalue") => returns False for failure
In other words, storing the same value as already exists leads to a return value that indicates failure. I assume this means that the underlying code is checking the MySQL affected rows, and 0 affected rows is being reported as a failure.
Is there any way to get around this, so that storing the same value (successfully) again is reported as a success? I’m thinking that perhaps the optional $prev_value parameter of the update_user_meta function may be helpful here, but the documentation of its use is not clear to me.