Yoast\WP\SEO\User_Meta\User_Interface
Custom_Meta_Integration::process_user_option_update
Updates the user metas that (might) have been set on the user profile page.
Метод класса: Custom_Meta_Integration{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Custom_Meta_Integration = new Custom_Meta_Integration(); $Custom_Meta_Integration->process_user_option_update( $user_id );
- $user_id(int) (обязательный)
- User ID of the updated user.
Код Custom_Meta_Integration::process_user_option_update() Custom Meta Integration::process user option update Yoast 27.9
public function process_user_option_update( $user_id ) {
\update_user_meta( $user_id, '_yoast_wpseo_profile_updated', \time() );
if ( ! \check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' ) ) {
return;
}
foreach ( $this->custom_meta_collector->get_custom_meta() as $meta ) {
if ( ! $meta->is_setting_enabled() ) {
continue;
}
$meta_field_id = $meta->get_field_id();
$user_input_to_store = isset( $_POST[ $meta_field_id ] ) ? \sanitize_text_field( \wp_unslash( $_POST[ $meta_field_id ] ) ) : '';
if ( $meta->is_empty_allowed() || $user_input_to_store !== '' ) {
\update_user_meta( $user_id, $meta->get_key(), $user_input_to_store );
continue;
}
\delete_user_meta( $user_id, $meta->get_key() );
}
}