WPSEO_Admin_User_Profile::process_user_option_update()publicYoast 1.0

Updates the user metas that (might) have been set on the user profile page.

Метод класса: WPSEO_Admin_User_Profile{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPSEO_Admin_User_Profile = new WPSEO_Admin_User_Profile();
$WPSEO_Admin_User_Profile->process_user_option_update( $user_id );
$user_id(int) (обязательный)
User ID of the updated user.

Код WPSEO_Admin_User_Profile::process_user_option_update() Yoast 22.4

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;
	}

	$wpseo_author_title                        = isset( $_POST['wpseo_author_title'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_title'] ) ) : '';
	$wpseo_author_metadesc                     = isset( $_POST['wpseo_author_metadesc'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_metadesc'] ) ) : '';
	$wpseo_noindex_author                      = isset( $_POST['wpseo_noindex_author'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_noindex_author'] ) ) : '';
	$wpseo_content_analysis_disable            = isset( $_POST['wpseo_content_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_content_analysis_disable'] ) ) : '';
	$wpseo_keyword_analysis_disable            = isset( $_POST['wpseo_keyword_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_keyword_analysis_disable'] ) ) : '';
	$wpseo_inclusive_language_analysis_disable = isset( $_POST['wpseo_inclusive_language_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_inclusive_language_analysis_disable'] ) ) : '';

	update_user_meta( $user_id, 'wpseo_title', $wpseo_author_title );
	update_user_meta( $user_id, 'wpseo_metadesc', $wpseo_author_metadesc );
	update_user_meta( $user_id, 'wpseo_noindex_author', $wpseo_noindex_author );
	update_user_meta( $user_id, 'wpseo_content_analysis_disable', $wpseo_content_analysis_disable );
	update_user_meta( $user_id, 'wpseo_keyword_analysis_disable', $wpseo_keyword_analysis_disable );
	update_user_meta( $user_id, 'wpseo_inclusive_language_analysis_disable', $wpseo_inclusive_language_analysis_disable );
}