6256 | | update_option( '_wp_privacy_text_change_check', 'check' ); |
| 6259 | get_option( '_wp_privacy_text_change_check', 'check' ); |
| 6260 | } |
| 6261 | |
| 6262 | /** |
| 6263 | * Adds an anonymous user to the database if none exists, and returns the users ID to anonymize. |
| 6264 | * |
| 6265 | * @since 4.9.6 |
| 6266 | * |
| 6267 | * @return int $anonymous_user_id ID if the anonymous user, or 0 if user could not be created. |
| 6268 | */ |
| 6269 | function _wp_privacy_get_anonymous_user_id() |
| 6270 | { |
| 6271 | $anonymous_user_id = (int) get_option('_anonymous_user_id'); |
| 6272 | |
| 6273 | if ( ! $anonymous_user_id ) { |
| 6274 | $anonymous_user_id = wp_insert_user(array( |
| 6275 | 'user_login' => 'anonymous', |
| 6276 | 'user_pass' => NULL, |
| 6277 | 'user_nicename' => __('Anonymous'), |
| 6278 | 'user_email' => wp_privacy_anonymize_data('email', ''), |
| 6279 | 'display_name' => __('Anonymous'), |
| 6280 | 'description' => __('Anonymous user used to assign posts to when the user requested deletion though privacy tools.'), |
| 6281 | 'role' => 'anonymous_user', // Does not exist. This should prevent the user from logging in or getting into wp_admin by all means. |
| 6282 | )); |
| 6283 | |
| 6284 | if (!is_wp_error($anonymous_user_id)) { |
| 6285 | update_option('_anonymous_user_id', (int) $anonymous_user_id); |
| 6286 | } |
| 6287 | } |
| 6288 | |
| 6289 | return is_wp_error($anonymous_user_id) ? 0 : $anonymous_user_id; |