• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 6987097851

25 Nov 2023 04:49AM UTC coverage: 49.206% (-0.1%) from 49.302%
6987097851

push

github

web-flow
Merge pull request #20878 from Yoast/JRF/ghactions-minor-tweak

GH Actions: update a few links in inline comments

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.62
/admin/class-admin-user-profile.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 * @since   1.8.0
7
 */
8

9
/**
10
 * Customizes user profile.
11
 */
12
class WPSEO_Admin_User_Profile {
13

14
        /**
15
         * Class constructor.
16
         */
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
                add_action( 'update_user_meta', [ $this, 'clear_author_sitemap_cache' ], 10, 3 );
×
24
        }
25

26
        /**
27
         * Clear author sitemap cache when settings are changed.
28
         *
29
         * @since 3.1
30
         *
31
         * @param int    $meta_id   The ID of the meta option changed.
32
         * @param int    $object_id The ID of the user.
33
         * @param string $meta_key  The key of the meta field changed.
34
         */
35
        public function clear_author_sitemap_cache( $meta_id, $object_id, $meta_key ) {
×
36
                if ( $meta_key === '_yoast_wpseo_profile_updated' ) {
×
37
                        WPSEO_Sitemaps_Cache::clear( [ 'author' ] );
×
38
                }
39
        }
40

41
        /**
42
         * Updates the user metas that (might) have been set on the user profile page.
43
         *
44
         * @param int $user_id User ID of the updated user.
45
         */
46
        public function process_user_option_update( $user_id ) {
24✔
47
                update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );
24✔
48

49
                if ( ! check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' ) ) {
24✔
50
                        return;
2✔
51
                }
52

53
                $wpseo_author_title                        = isset( $_POST['wpseo_author_title'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_title'] ) ) : '';
22✔
54
                $wpseo_author_metadesc                     = isset( $_POST['wpseo_author_metadesc'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_author_metadesc'] ) ) : '';
22✔
55
                $wpseo_noindex_author                      = isset( $_POST['wpseo_noindex_author'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_noindex_author'] ) ) : '';
22✔
56
                $wpseo_content_analysis_disable            = isset( $_POST['wpseo_content_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_content_analysis_disable'] ) ) : '';
22✔
57
                $wpseo_keyword_analysis_disable            = isset( $_POST['wpseo_keyword_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_keyword_analysis_disable'] ) ) : '';
22✔
58
                $wpseo_inclusive_language_analysis_disable = isset( $_POST['wpseo_inclusive_language_analysis_disable'] ) ? sanitize_text_field( wp_unslash( $_POST['wpseo_inclusive_language_analysis_disable'] ) ) : '';
22✔
59

60
                update_user_meta( $user_id, 'wpseo_title', $wpseo_author_title );
22✔
61
                update_user_meta( $user_id, 'wpseo_metadesc', $wpseo_author_metadesc );
22✔
62
                update_user_meta( $user_id, 'wpseo_noindex_author', $wpseo_noindex_author );
22✔
63
                update_user_meta( $user_id, 'wpseo_content_analysis_disable', $wpseo_content_analysis_disable );
22✔
64
                update_user_meta( $user_id, 'wpseo_keyword_analysis_disable', $wpseo_keyword_analysis_disable );
22✔
65
                update_user_meta( $user_id, 'wpseo_inclusive_language_analysis_disable', $wpseo_inclusive_language_analysis_disable );
22✔
66
        }
11✔
67

68
        /**
69
         * Add the inputs needed for SEO values to the User Profile page.
70
         *
71
         * @param WP_User $user User instance to output for.
72
         */
73
        public function user_profile( $user ) {
×
74
                wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );
×
75

76
                require_once WPSEO_PATH . 'admin/views/user-profile.php';
×
77
        }
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc