WordPress.org

Make WordPress Core

Ticket #25726: 25726.diff

File 25726.diff, 4.2 KB (added by admiralthrawn, 6 years ago)
Line 
1Index: src/wp-includes/ms-default-filters.php
2===================================================================
3--- src/wp-includes/ms-default-filters.php      (revision 25946)
4+++ src/wp-includes/ms-default-filters.php      (working copy)
5@@ -62,6 +62,11 @@
6 if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
7        add_filter( 'enable_post_by_email_configuration', '__return_false' );
8 if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
9+       /**
10+        * The multisite constant EDIT_ANY_USER turns into filter.
11+        *
12+        * @since 3.0
13+        */
14        add_filter( 'enable_edit_any_user_configuration', '__return_false' );
15 add_filter( 'force_filtered_html_on_import', '__return_true' );
16Index: src/wp-admin/user-new.php
17===================================================================
18--- src/wp-admin/user-new.php   (revision 25946)
19+++ src/wp-admin/user-new.php   (working copy)
20@@ -377,13 +377,7 @@
21                <td><input name="url" type="text" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td>
22        </tr>
23 <?php
24-/**
25- * Filter the display of the password fields.
26- *
27- * @since 1.5.1
28- *
29- * @param bool True or false, based on if you want to show the password fields. Default is true.
30- */
31+/** This filter is documented in wp-admin/user-edit.php */
32 if ( apply_filters( 'show_password_fields', true ) ) : ?>
33        <tr class="form-field form-required">
34                <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
35Index: src/wp-admin/user-edit.php
36===================================================================
37--- src/wp-admin/user-edit.php  (revision 25946)
38+++ src/wp-admin/user-edit.php  (working copy)
39@@ -75,7 +75,9 @@
40 }
41 
42 // Only allow super admins on multisite to edit every user.
43-if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
44+if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID
45+       /** Filter is documented in wp-admin/user-edit.php */
46+       && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
47        wp_die( __( 'You do not have permission to edit this user.' ) );
48 
49 // Execute confirmed email change. See send_confirmation_on_profile_email().
50@@ -353,7 +355,18 @@
51        foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
52 ?>
53 <tr>
54-       <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
55+       <th><label for="<?php echo $name; ?>">
56+               <?php
57+               /**
58+                * This filter allows adding and removing contact methods from user profiles.
59+                *
60+                * @since 2.9.0
61+                *
62+                * @param string $desc - the description of the contact method
63+                */
64+               echo apply_filters('user_'.$name.'_label', $desc);
65+               ?>
66+       </label></th>
67        <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
68 </tr>
69 <?php
70@@ -371,6 +384,14 @@
71 </tr>
72 
73 <?php
74+/**
75+ * Filter the display of the password fields.
76+ *
77+ * @since 1.5.1
78+ *
79+ * @param bool True or false, based on if you want to show the password fields. Default is true.
80+ * @param WP_User, the current user.
81+ */
82 $show_password_fields = apply_filters('show_password_fields', true, $profileuser);
83 if ( $show_password_fields ) :
84 ?>
85@@ -392,7 +413,6 @@
86 </tr>
87 <?php endif; ?>
88 </table>
89-
90 <?php
91        if ( IS_PROFILE_PAGE )
92                do_action( 'show_user_profile', $profileuser );
93@@ -400,7 +420,17 @@
94                do_action( 'edit_user_profile', $profileuser );
95 ?>
96 
97-<?php if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) : ?>
98+<?php
99+/**
100+ * Allows plugins to overwrite the display of
101+ * "Additional Capabilities" section in user accounts.
102+ *
103+ * @since 2.8.0
104+ *
105+ * @param bool True or false, whether or not to overwrite. Default is true.
106+ * @param WP_User, the current user.
107+ */
108+if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) : ?>
109 <h3><?php _e( 'Additional Capabilities' ); ?></h3>
110 <table class="form-table">
111 <tr>