PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | admin/class-admin-user-profile.php +24 -40 18.728.5 View file →
@@ -14,13 +14,8 @@
14 14 /**
15 15 * Class constructor.
16 16 */
17 17 public function __construct() {
18 - add_action( 'show_user_profile', [ $this, 'user_profile' ] );
19 - add_action( 'edit_user_profile', [ $this, 'user_profile' ] );
20 - add_action( 'personal_options_update', [ $this, 'process_user_option_update' ] );
21 - add_action( 'edit_user_profile_update', [ $this, 'process_user_option_update' ] );
22 -
23 18 add_action( 'update_user_meta', [ $this, 'clear_author_sitemap_cache' ], 10, 3 );
24 19 }
25 20
26 21 /**
@@ -30,8 +25,10 @@
30 25 *
31 26 * @param int $meta_id The ID of the meta option changed.
32 27 * @param int $object_id The ID of the user.
33 28 * @param string $meta_key The key of the meta field changed.
29 + *
30 + * @return void
34 31 */
35 32 public function clear_author_sitemap_cache( $meta_id, $object_id, $meta_key ) {
36 33 if ( $meta_key === '_yoast_wpseo_profile_updated' ) {
37 34 WPSEO_Sitemaps_Cache::clear( [ 'author' ] );
@@ -38,52 +35,39 @@
38 35 }
39 36 }
40 37
41 38 /**
42 - * Filter POST variables.
39 + * Updates the user metas that (might) have been set on the user profile page.
43 40 *
44 - * @param string $var_name Name of the variable to filter.
41 + * @deprecated 22.6
42 + * @codeCoverageIgnore
45 43 *
46 - * @return mixed
47 - */
48 - private function filter_input_post( $var_name ) {
49 - $val = filter_input( INPUT_POST, $var_name );
50 - if ( $val ) {
51 - return WPSEO_Utils::sanitize_text_field( $val );
52 - }
53 - return '';
54 - }
55 -
56 - /**
57 - * Updates the user metas that (might) have been set on the user profile page.
44 + * @param int $user_id User ID of the updated user.
58 45 *
59 - * @param int $user_id User ID of the updated user.
46 + * @return void
60 47 */
61 48 public function process_user_option_update( $user_id ) {
49 + _deprecated_function( __METHOD__, 'Yoast SEO 22.6' );
50 +
62 51 update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );
63 52
64 - $nonce_value = $this->filter_input_post( 'wpseo_nonce' );
65 -
66 - if ( empty( $nonce_value ) ) { // Submit from alternate forms.
53 + if ( ! check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' ) ) {
67 54 return;
68 55 }
69 56
70 - check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' );
57 + $wpseo_author_title = isset( $_POST['wpseo_author_title'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_title'] ) ) : '';
58 + $wpseo_author_metadesc = isset( $_POST['wpseo_author_metadesc'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_metadesc'] ) ) : '';
59 + $wpseo_author_pronouns = isset( $_POST['wpseo_author_pronouns'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_pronouns'] ) ) : '';
60 + $wpseo_noindex_author = isset( $_POST['wpseo_noindex_author'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_noindex_author'] ) ) : '';
61 + $wpseo_content_analysis_disable = isset( $_POST['wpseo_content_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_content_analysis_disable'] ) ) : '';
62 + $wpseo_keyword_analysis_disable = isset( $_POST['wpseo_keyword_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_keyword_analysis_disable'] ) ) : '';
63 + $wpseo_inclusive_language_analysis_disable = isset( $_POST['wpseo_inclusive_language_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_inclusive_language_analysis_disable'] ) ) : '';
71 64
72 - update_user_meta( $user_id, 'wpseo_title', $this->filter_input_post( 'wpseo_author_title' ) );
73 - update_user_meta( $user_id, 'wpseo_metadesc', $this->filter_input_post( 'wpseo_author_metadesc' ) );
74 - update_user_meta( $user_id, 'wpseo_noindex_author', $this->filter_input_post( 'wpseo_noindex_author' ) );
75 - update_user_meta( $user_id, 'wpseo_content_analysis_disable', $this->filter_input_post( 'wpseo_content_analysis_disable' ) );
76 - update_user_meta( $user_id, 'wpseo_keyword_analysis_disable', $this->filter_input_post( 'wpseo_keyword_analysis_disable' ) );
77 - }
78 -
79 - /**
80 - * Add the inputs needed for SEO values to the User Profile page.
81 - *
82 - * @param WP_User $user User instance to output for.
83 - */
84 - public function user_profile( $user ) {
85 - wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );
86 -
87 - require_once WPSEO_PATH . 'admin/views/user-profile.php';
65 + update_user_meta( $user_id, 'wpseo_title', $wpseo_author_title );
66 + update_user_meta( $user_id, 'wpseo_metadesc', $wpseo_author_metadesc );
67 + update_user_meta( $user_id, 'wpseo_pronouns', $wpseo_author_pronouns );
68 + update_user_meta( $user_id, 'wpseo_noindex_author', $wpseo_noindex_author );
69 + update_user_meta( $user_id, 'wpseo_content_analysis_disable', $wpseo_content_analysis_disable );
70 + update_user_meta( $user_id, 'wpseo_keyword_analysis_disable', $wpseo_keyword_analysis_disable );
71 + update_user_meta( $user_id, 'wpseo_inclusive_language_analysis_disable', $wpseo_inclusive_language_analysis_disable );
88 72 }
89 73 }