| | 1857 | /** |
| | 1858 | * Displays the Privacy widget. |
| | 1859 | * |
| | 1860 | * @since 5.4.0 |
| | 1861 | */ |
| | 1862 | function wp_dashboard_privacy() { |
| | 1863 | // Show the policy message only to users with manage_privacy_options cap. |
| | 1864 | if ( current_user_can( 'manage_privacy_options' ) ) { |
| | 1865 | echo '<p>'; |
| | 1866 | |
| | 1867 | printf( |
| | 1868 | /* translators: 1: Privacy Policy guide URL*/ |
| | 1869 | __( 'Need help putting together your Privacy Policy page? <a href="%1$s">Check out our guide</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ), |
| | 1870 | esc_url( admin_url( 'privacy-policy-guide.php' ) ) |
| | 1871 | ); |
| | 1872 | |
| | 1873 | echo '</p>'; |
| | 1874 | } |
| | 1875 | |
| | 1876 | // Show the export personal data stats only to users with export_others_personal_data cap. |
| | 1877 | if ( current_user_can( 'export_others_personal_data' ) ) { |
| | 1878 | $pending = 0; |
| | 1879 | $confirmed = 0; |
| | 1880 | $failed = 0; |
| | 1881 | $completed = 0; |
| | 1882 | |
| | 1883 | $requests = get_posts( |
| | 1884 | array( |
| | 1885 | 'numberposts' => -1, |
| | 1886 | 'post_type' => 'user_request', |
| | 1887 | 'post_name__in' => array( 'export_personal_data' ), // Request type stored in post_name column. |
| | 1888 | 'post_status' => array( |
| | 1889 | 'request-pending', |
| | 1890 | 'request-confirmed', |
| | 1891 | 'request-failed', |
| | 1892 | 'request-completed', |
| | 1893 | ), |
| | 1894 | ) |
| | 1895 | ); |
| | 1896 | |
| | 1897 | foreach ( $requests as $request ) { |
| | 1898 | switch ( $request->post_status ) { |
| | 1899 | case 'request-pending': |
| | 1900 | $pending++; |
| | 1901 | break; |
| | 1902 | case 'request-confirmed': |
| | 1903 | $confirmed++; |
| | 1904 | break; |
| | 1905 | case 'request-failed': |
| | 1906 | $failed++; |
| | 1907 | break; |
| | 1908 | case 'request-completed': |
| | 1909 | $completed++; |
| | 1910 | break; |
| | 1911 | } |
| | 1912 | } |
| | 1913 | echo '<p>'; |
| | 1914 | /* translators: %s: Number of Data Export Requests. */ |
| | 1915 | $text = _n( '%s Export Personal Data Request', '%s Export Personal Data Requests', count( $requests ) ); |
| | 1916 | $text = sprintf( $text, number_format_i18n( count( $requests ) ) ); |
| | 1917 | /* translators: %1$s: Data Export Requests wp-admin screen. %2$s Number of Total Data Export Requests. */ |
| | 1918 | printf( |
| | 1919 | '<a href="%1$s">%2$s</a>', |
| | 1920 | esc_url( admin_url( 'export-personal-data.php' ) ), |
| | 1921 | $text |
| | 1922 | ); |
| | 1923 | echo '<br> • '; |
| | 1924 | /* translators: %1$d Number of Pending Export Requests. */ |
| | 1925 | echo sprintf( '%1$d Pending', $pending ) . ', '; |
| | 1926 | /* translators: %1$d Number of Confirmed Export Requests. */ |
| | 1927 | echo sprintf( '%1$d Confirmed', $confirmed ) . ', '; |
| | 1928 | /* translators: %1$d Number of Failed Export Requests. */ |
| | 1929 | echo sprintf( '%1$d Failed', $failed ) . ', '; |
| | 1930 | /* translators: %1$d Number of Completed Export Requests. */ |
| | 1931 | echo sprintf( '%1$d Completed', $completed ); |
| | 1932 | echo '</p>'; |
| | 1933 | } |
| | 1934 | |
| | 1935 | // Show the erase personal data stats only to users with erase_others_personal_data cap. |
| | 1936 | if ( current_user_can( 'erase_others_personal_data' ) ) { |
| | 1937 | $pending = 0; |
| | 1938 | $confirmed = 0; |
| | 1939 | $failed = 0; |
| | 1940 | $completed = 0; |
| | 1941 | |
| | 1942 | $requests = get_posts( |
| | 1943 | array( |
| | 1944 | 'numberposts' => -1, |
| | 1945 | 'post_type' => 'user_request', |
| | 1946 | 'post_name__in' => array( 'remove_personal_data' ), // Request type stored in post_name column. |
| | 1947 | 'post_status' => array( |
| | 1948 | 'request-pending', |
| | 1949 | 'request-confirmed', |
| | 1950 | 'request-failed', |
| | 1951 | 'request-completed', |
| | 1952 | ), |
| | 1953 | ) |
| | 1954 | ); |
| | 1955 | |
| | 1956 | foreach ( $requests as $request ) { |
| | 1957 | switch ( $request->post_status ) { |
| | 1958 | case 'request-pending': |
| | 1959 | $pending++; |
| | 1960 | break; |
| | 1961 | case 'request-confirmed': |
| | 1962 | $confirmed++; |
| | 1963 | break; |
| | 1964 | case 'request-failed': |
| | 1965 | $failed++; |
| | 1966 | break; |
| | 1967 | case 'request-completed': |
| | 1968 | $completed++; |
| | 1969 | break; |
| | 1970 | } |
| | 1971 | } |
| | 1972 | echo '<p>'; |
| | 1973 | /* translators: %s: Number of Data Export Requests. */ |
| | 1974 | $text = _n( '%s Erase Personal Data Request', '%s Erase Personal Data Requests', count( $requests ) ); |
| | 1975 | $text = sprintf( $text, number_format_i18n( count( $requests ) ) ); |
| | 1976 | /* translators: %1$s: Data Export Requests wp-admin screen. %2$s Number of Total Data Export Requests. */ |
| | 1977 | printf( |
| | 1978 | '<a href="%1$s">%2$s</a>', |
| | 1979 | esc_url( admin_url( 'erase-personal-data.php' ) ), |
| | 1980 | $text |
| | 1981 | ); |
| | 1982 | echo '<br> • '; |
| | 1983 | /* translators: %1$d Number of Pending Export Requests. */ |
| | 1984 | echo sprintf( '%1$d Pending', $pending ) . ', '; |
| | 1985 | /* translators: %1$d Number of Confirmed Export Requests. */ |
| | 1986 | echo sprintf( '%1$d Confirmed', $confirmed ) . ', '; |
| | 1987 | /* translators: %1$d Number of Failed Export Requests. */ |
| | 1988 | echo sprintf( '%1$d Failed', $failed ) . ', '; |
| | 1989 | /* translators: %1$d Number of Completed Export Requests. */ |
| | 1990 | echo sprintf( '%1$d Completed', $completed ); |
| | 1991 | echo '</p>'; |
| | 1992 | } |
| | 1993 | } |
| | 1994 | |