<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26493] trunk/src: Inline documentation for hooks in wp-admin/user-new.php & wp-admin/user-edit.php.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26493">26493</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2013-12-01 01:34:15 +0000 (Sun, 01 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-admin/user-new.php & wp-admin/user-edit.php.
Also fixes one parameter type in wp-includes/user.php.
Fixes <a href="http://core.trac.wordpress.org/ticket/25726">#25726</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminusereditphp">trunk/src/wp-admin/user-edit.php</a></li>
<li><a href="#trunksrcwpadminusernewphp">trunk/src/wp-admin/user-new.php</a></li>
<li><a href="#trunksrcwpincludesuserphp">trunk/src/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminusereditphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/user-edit.php (26492 => 26493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/user-edit.php 2013-12-01 01:24:41 UTC (rev 26492)
+++ trunk/src/wp-admin/user-edit.php 2013-12-01 01:34:15 UTC (rev 26493)
</span><span class="lines">@@ -74,9 +74,26 @@
</span><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Only allow super admins on multisite to edit every user.
-if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
</del><ins>+/**
+ * Filter whether to allow administrators on Multisite to edit every user.
+ *
+ * Enabling the user editing form via this filter also hinges on the user holding
+ * the 'manage_network_users' cap, and the logged-in user not matching the user
+ * profile open for editing.
+ *
+ * The filter was introduced to replace the EDIT_ANY_USER constant.
+ *
+ * @since 3.0.0
+ *
+ * @param bool $allow Whether to allow editing of any user. Default true.
+ */
+if ( is_multisite()
+ && ! current_user_can( 'manage_network_users' )
+ && $user_id != $current_user->ID
+ && ! apply_filters( 'enable_edit_any_user_configuration', true )
+) {
</ins><span class="cx"> wp_die( __( 'You do not have permission to edit this user.' ) );
</span><ins>+}
</ins><span class="cx">
</span><span class="cx"> // Execute confirmed email change. See send_confirmation_on_profile_email().
</span><span class="cx"> if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
</span><span class="lines">@@ -106,10 +123,27 @@
</span><span class="cx"> if ( !current_user_can('edit_user', $user_id) )
</span><span class="cx"> wp_die(__('You do not have permission to edit this user.'));
</span><span class="cx">
</span><del>-if ( IS_PROFILE_PAGE )
- do_action('personal_options_update', $user_id);
-else
- do_action('edit_user_profile_update', $user_id);
</del><ins>+if ( IS_PROFILE_PAGE ) {
+ /**
+ * Fires before the page loads on the 'Your Profile' editing screen.
+ *
+ * The action only fires if the current user is editing their own profile.
+ *
+ * @since 2.0.0
+ *
+ * @param int $user_id The user ID.
+ */
+ do_action( 'personal_options_update', $user_id );
+} else {
+ /**
+ * Fires before the page loads on the 'Edit User' screen.
+ *
+ * @since 2.7.0
+ *
+ * @param int $user_id The user ID.
+ */
+ do_action( 'edit_user_profile_update', $user_id );
+}
</ins><span class="cx">
</span><span class="cx"> if ( !is_multisite() ) {
</span><span class="cx"> $errors = edit_user($user_id);
</span><span class="lines">@@ -188,8 +222,14 @@
</span><span class="cx"> <?php }
</span><span class="cx"> } ?>
</span><span class="cx"> </h2>
</span><del>-
-<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>>
</del><ins>+<?php
+/**
+ * Fires inside the your-profile form tag on the user editing screen.
+ *
+ * @since 3.0.0
+ */
+?>
+<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action( 'user_edit_form_tag' ); ?>>
</ins><span class="cx"> <?php wp_nonce_field('update-user_' . $user_id) ?>
</span><span class="cx"> <?php if ( $wp_http_referer ) : ?>
</span><span class="cx"> <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
</span><span class="lines">@@ -211,6 +251,16 @@
</span><span class="cx"> <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
</span><span class="cx"> <tr>
</span><span class="cx"> <th scope="row"><?php _e('Admin Color Scheme')?></th>
</span><ins>+<?php
+/**
+ * Fires in the 'Admin Color Scheme' section of the user editing screen.
+ *
+ * The section is only enabled if a callback is hooked to the action,
+ * and if there is more than one defined color scheme for the admin.
+ *
+ * @since 3.0.0
+ */
+?>
</ins><span class="cx"> <td><?php do_action( 'admin_color_scheme_picker' ); ?></td>
</span><span class="cx"> </tr>
</span><span class="cx"> <?php
</span><span class="lines">@@ -230,11 +280,30 @@
</span><span class="cx"> </fieldset>
</span><span class="cx"> </td>
</span><span class="cx"> </tr>
</span><del>-<?php do_action('personal_options', $profileuser); ?>
</del><ins>+<?php
+/**
+ * Fires at the end of the 'Personal Options' settings table on the user editing screen.
+ *
+ * @since 2.7.0
+ *
+ * @param WP_User $profileuser The current WP_User object.
+ */
+do_action( 'personal_options', $profileuser );
+?>
</ins><span class="cx"> </table>
</span><span class="cx"> <?php
</span><del>- if ( IS_PROFILE_PAGE )
- do_action('profile_personal_options', $profileuser);
</del><ins>+ if ( IS_PROFILE_PAGE ) {
+ /**
+ * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
+ *
+ * The action only fires if the current user is editing their own profile.
+ *
+ * @since 2.0.0
+ *
+ * @param WP_User $profileuser The current WP_User object.
+ */
+ do_action( 'profile_personal_options', $profileuser );
+ }
</ins><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx"> <h3><?php _e('Name') ?></h3>
</span><span class="lines">@@ -353,7 +422,19 @@
</span><span class="cx"> foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
</span><span class="cx"> ?>
</span><span class="cx"> <tr>
</span><del>- <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
</del><ins>+ <?php
+ /**
+ * Filter a user contactmethod label.
+ *
+ * The dynamic portion of the filter hook, $name, refers to
+ * each of the keys in the contactmethods array.
+ *
+ * @since 2.9.0
+ *
+ * @param string $desc The translatable label for the contactmethod.
+ */
+ ?>
+ <th><label for="<?php echo $name; ?>"><?php echo apply_filters( "user_{$name}_label", $desc ); ?></label></th>
</ins><span class="cx"> <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
</span><span class="cx"> </tr>
</span><span class="cx"> <?php
</span><span class="lines">@@ -371,7 +452,8 @@
</span><span class="cx"> </tr>
</span><span class="cx">
</span><span class="cx"> <?php
</span><del>-$show_password_fields = apply_filters('show_password_fields', true, $profileuser);
</del><ins>+/** This filter is documented in wp-admin/user-new.php */
+$show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );
</ins><span class="cx"> if ( $show_password_fields ) :
</span><span class="cx"> ?>
</span><span class="cx"> <tr id="password">
</span><span class="lines">@@ -396,13 +478,45 @@
</span><span class="cx"> </table>
</span><span class="cx">
</span><span class="cx"> <?php
</span><del>- if ( IS_PROFILE_PAGE )
</del><ins>+ if ( IS_PROFILE_PAGE ) {
+ /**
+ * Fires after the 'About the User' settings table on the 'Your Profile' editing screen.
+ *
+ * The action only fires if the current user is editing their own profile.
+ *
+ * @since 2.0.0
+ *
+ * @param WP_User $profileuser The current WP_User object.
+ */
</ins><span class="cx"> do_action( 'show_user_profile', $profileuser );
</span><del>- else
</del><ins>+ } else {
+ /**
+ * Fires after the 'About the User' settings table on the 'Edit User' screen.
+ *
+ * @since 2.0.0
+ *
+ * @param WP_User $profileuser The current WP_User object.
+ */
</ins><span class="cx"> do_action( 'edit_user_profile', $profileuser );
</span><ins>+ }
</ins><span class="cx"> ?>
</span><span class="cx">
</span><del>-<?php if ( count( $profileuser->caps ) > count( $profileuser->roles ) && apply_filters( 'additional_capabilities_display', true, $profileuser ) ) : ?>
</del><ins>+<?php
+/**
+ * Filter whether to display additional capabilities for the user.
+ *
+ * The 'Additional Capabilities' section will only be enabled if
+ * the number of the user's capabilities exceeds their number of
+ * of roles.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $enable Whether to display the capabilities. Default true.
+ * @param WP_User $profileuser The current WP_User object.
+ */
+if ( count( $profileuser->caps ) > count( $profileuser->roles )
+ && apply_filters( 'additional_capabilities_display', true, $profileuser )
+) : ?>
</ins><span class="cx"> <h3><?php _e( 'Additional Capabilities' ); ?></h3>
</span><span class="cx"> <table class="form-table">
</span><span class="cx"> <tr>
</span></span></pre></div>
<a id="trunksrcwpadminusernewphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/user-new.php (26492 => 26493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/user-new.php 2013-12-01 01:24:41 UTC (rev 26492)
+++ trunk/src/wp-admin/user-new.php 2013-12-01 01:34:15 UTC (rev 26493)
</span><span class="lines">@@ -117,11 +117,11 @@
</span><span class="cx"> $add_user_errors = $user_details[ 'errors' ];
</span><span class="cx"> } else {
</span><span class="cx"> /**
</span><del>- * Filter the user_login, aka the username, before it is added to the site.
</del><ins>+ * Filter the user_login, also known as the username, before it is added to the site.
</ins><span class="cx"> *
</span><del>- * @since 3.0.0
</del><ins>+ * @since 2.0.3
</ins><span class="cx"> *
</span><del>- * @param string $_REQUEST['user_login'] The sanitized username.
</del><ins>+ * @param string $user_login The sanitized username.
</ins><span class="cx"> */
</span><span class="cx"> $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
</span><span class="cx"> if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
</span><span class="lines">@@ -189,11 +189,11 @@
</span><span class="cx"> wp_enqueue_script('user-profile');
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Allows you to enable user auto-complete for non-super admins in multisite.
</del><ins>+ * Filter whether to enable user auto-complete for non-super admins in Multisite.
</ins><span class="cx"> *
</span><span class="cx"> * @since 3.4.0
</span><span class="cx"> *
</span><del>- * @param bool True or false, based on if you enable auto-complete for non-super admins. Default is false.
</del><ins>+ * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
</ins><span class="cx"> */
</span><span class="cx"> if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
</span><span class="cx"> && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
</span><span class="lines">@@ -287,7 +287,7 @@
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> */
</span><span class="cx"> ?>
</span><del>-<form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action('user_new_form_tag');?>>
</del><ins>+<form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action( 'user_new_form_tag' );?>>
</ins><span class="cx"> <input name="action" type="hidden" value="adduser" />
</span><span class="cx"> <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
</span><span class="cx">
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 3.7.0
</span><span class="cx"> *
</span><del>- * @param string A contextual string specifying which type of new user form the hook follows.
</del><ins>+ * @param string $type A contextual string specifying which type of new user form the hook follows.
</ins><span class="cx"> */
</span><span class="cx"> do_action( 'user_new_form', 'add-existing-user' );
</span><span class="cx"> ?>
</span><span class="lines">@@ -334,10 +334,8 @@
</span><span class="cx"> echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>';
</span><span class="cx"> ?>
</span><span class="cx"> <p><?php _e('Create a brand new user and add them to this site.'); ?></p>
</span><del>-<?php
-/** This action is documented in wp-admin/user-new.php */
-?>
-<form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>>
</del><ins>+<?php /** This action is documented in wp-admin/user-new.php */ ?>
+<form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action( 'user_new_form_tag' );?>>
</ins><span class="cx"> <input name="action" type="hidden" value="createuser" />
</span><span class="cx"> <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
</span><span class="cx"> <?php
</span><span class="lines">@@ -382,7 +380,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @since 1.5.1
</span><span class="cx"> *
</span><del>- * @param bool True or false, based on if you want to show the password fields. Default is true.
</del><ins>+ * @param bool $show Whether to show the password fields. Default true.
</ins><span class="cx"> */
</span><span class="cx"> if ( apply_filters( 'show_password_fields', true ) ) : ?>
</span><span class="cx"> <tr class="form-field form-required">
</span></span></pre></div>
<a id="trunksrcwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/user.php (26492 => 26493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/user.php 2013-12-01 01:24:41 UTC (rev 26492)
+++ trunk/src/wp-includes/user.php 2013-12-01 01:34:15 UTC (rev 26493)
</span><span class="lines">@@ -1564,7 +1564,7 @@
</span><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><span class="cx"> * @param array $methods Array of contact methods and their labels.
</span><del>- * @param WP_User $user Optional. WP_User object.
</del><ins>+ * @param WP_User $user WP_User object.
</ins><span class="cx"> */
</span><span class="cx"> return apply_filters( 'user_contactmethods', $methods, $user );
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>