PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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 +2 -54 18.4.1 → trunk 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,60 +25,13 @@
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 35 }
39 - }
40 -
41 - /**
42 - * Filter POST variables.
43 - *
44 - * @param string $var_name Name of the variable to filter.
45 - *
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.
58 - *
59 - * @param int $user_id User ID of the updated user.
60 - */
61 - public function process_user_option_update( $user_id ) {
62 - update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );
63 -
64 - $nonce_value = $this->filter_input_post( 'wpseo_nonce' );
65 -
66 - if ( empty( $nonce_value ) ) { // Submit from alternate forms.
67 - return;
68 - }
69 -
70 - check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' );
71 -
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';
88 36 }
89 37 }