<!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>[26901] trunk/src/wp-includes/user.php: Inline documentation for hooks in wp-includes/user.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/26901">26901</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-01-04 06:17:18 +0000 (Sat, 04 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-includes/user.php.
Props stephenharris, kpdesign.
Fixes <a href="http://core.trac.wordpress.org/ticket/25533">#25533</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesuserphp">trunk/src/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/user.php (26900 => 26901)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/user.php 2014-01-04 01:27:59 UTC (rev 26900)
+++ trunk/src/wp-includes/user.php 2014-01-04 06:17:18 UTC (rev 26901)
</span><span class="lines">@@ -38,12 +38,38 @@
</span><span class="cx"> $credentials['remember'] = false;
</span><span class="cx">
</span><span class="cx"> // TODO do we deprecate the wp_authentication action?
</span><del>- do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
</del><ins>+ /**
+ * Fires before the user is authenticated.
+ *
+ * The variables passed to the callbacks are passed by reference,
+ * and can be modified by callback functions.
+ *
+ * @since 1.5.1
+ *
+ * @param string $user_login Username, passed by reference.
+ * @param string $user_password User password, passed by reference.
+ */
+ do_action_ref_array( 'wp_authenticate', array( &$credentials['user_login'], &$credentials['user_password'] ) );
</ins><span class="cx">
</span><span class="cx"> if ( '' === $secure_cookie )
</span><span class="cx"> $secure_cookie = is_ssl();
</span><span class="cx">
</span><del>- $secure_cookie = apply_filters('secure_signon_cookie', $secure_cookie, $credentials);
</del><ins>+ /**
+ * Filter whether to use a secure sign-on cookie.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $secure_cookie Whether to use a secure sign-on cookie.
+ * @param array $credentials {
+ * Array of entered sign-on data.
+ *
+ * @type string $user_login Username.
+ * @type string $user_password Password entered.
+ * @type bool $remember Whether to 'remember' the user. Increases the time
+ * that the cookie will be kept. Default false.
+ * }
+ */
+ $secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
</ins><span class="cx">
</span><span class="cx"> global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
</span><span class="cx"> $auth_secure_cookie = $secure_cookie;
</span><span class="lines">@@ -61,7 +87,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
</span><del>- do_action('wp_login', $user->user_login, $user);
</del><ins>+ /**
+ * Fires after the user has successfully logged in.
+ *
+ * @since 1.5.0
+ *
+ * @param string $user_login Username.
+ * @param WP_User $user WP_User object of the logged-in user.
+ */
+ do_action( 'wp_login', $user->user_login, $user );
</ins><span class="cx"> return $user;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -92,7 +126,16 @@
</span><span class="cx"> if ( !$user )
</span><span class="cx"> return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?' ), wp_lostpassword_url() ) );
</span><span class="cx">
</span><del>- $user = apply_filters('wp_authenticate_user', $user, $password);
</del><ins>+ /**
+ * Filter whether the given user can be authenticated with the provided $password.
+ *
+ * @since 2.5.0
+ *
+ * @param WP_User|WP_Error $user WP_User or WP_Error object if a previous
+ * callback failed authentication.
+ * @param string $password Password to check against the user.
+ */
+ $user = apply_filters( 'wp_authenticate_user', $user, $password );
</ins><span class="cx"> if ( is_wp_error($user) )
</span><span class="cx"> return $user;
</span><span class="cx">
</span><span class="lines">@@ -138,6 +181,14 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_authenticate_spam_check( $user ) {
</span><span class="cx"> if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) {
</span><ins>+ /**
+ * Filter whether the user has been marked as a spammer.
+ *
+ * @since 3.7.0
+ *
+ * @param bool $spammed Whether the user is considered a spammer.
+ * @param WP_User $user User to check against.
+ */
</ins><span class="cx"> $spammed = apply_filters( 'check_is_user_spammed', is_user_spammy(), $user );
</span><span class="cx">
</span><span class="cx"> if ( $spammed )
</span><span class="lines">@@ -162,7 +213,15 @@
</span><span class="cx">
</span><span class="cx"> $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
</span><span class="cx">
</span><del>- return apply_filters('get_usernumposts', $count, $userid);
</del><ins>+ /**
+ * Filter the number of posts a user has written.
+ *
+ * @since 2.7.0
+ *
+ * @param int $count The user's post count.
+ * @param int $userid User ID.
+ */
+ return apply_filters( 'get_usernumposts', $count, $userid );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -258,7 +317,18 @@
</span><span class="cx"> else
</span><span class="cx"> $result = false;
</span><span class="cx">
</span><del>- return apply_filters("get_user_option_{$option}", $result, $option, $user);
</del><ins>+ /**
+ * Filter a specific user option value.
+ *
+ * The dynamic portion of the hook name, $option, refers to the user option name.
+ *
+ * @since 2.5.0
+ *
+ * @param mixed $result Value for the user's option.
+ * @param string $option Name of the option being retrieved.
+ * @param WP_User $user WP_User object of the user whose option is being retrieved.
+ */
+ return apply_filters( "get_user_option_{$option}", $result, $option, $user );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -496,6 +566,18 @@
</span><span class="cx"> $search_columns = array('user_login', 'user_nicename');
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the columns to search in a WP_User_Query search.
+ *
+ * The default columns depend on the search term, and include 'user_email',
+ * 'user_login', 'ID', 'user_url', and 'user_nicename'.
+ *
+ * @since 3.6.0
+ *
+ * @param array $search_columns Array of column names to be searched.
+ * @param string $search Text being searched.
+ * @param WP_User_Query $this The current WP_User_Query instance.
+ */
</ins><span class="cx"> $search_columns = apply_filters( 'user_search_columns', $search_columns, $search, $this );
</span><span class="cx">
</span><span class="cx"> $this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
</span><span class="lines">@@ -548,6 +630,18 @@
</span><span class="cx"> $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Fires after the WP_User_Query has been parsed, and before
+ * the query is executed.
+ *
+ * The passed WP_User_Query object contains SQL parts formed
+ * from parsing the given query.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_User_Query $this The current WP_User_Query instance,
+ * passed by reference.
+ */
</ins><span class="cx"> do_action_ref_array( 'pre_user_query', array( &$this ) );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -568,6 +662,15 @@
</span><span class="cx"> $this->results = $wpdb->get_col("SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter SELECT_FOUND_ROWS value for the current WP_User_Query instance.
+ *
+ * @since 3.2.0
+ *
+ * @global wpdb $wpdb WordPress database object.
+ *
+ * @param string $sql The SELECT_FOUND_ROWS() value for the current WP_User_Query.
+ */
</ins><span class="cx"> if ( isset( $qv['count_total'] ) && $qv['count_total'] )
</span><span class="cx"> $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
</span><span class="cx">
</span><span class="lines">@@ -776,6 +879,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Filter the list of blogs a user belongs to.
+ *
+ * @since MU
+ *
+ * @param array $blogs An array of blog objects belonging to the user.
+ * @param int $user_id User ID.
+ * @param bool $all Whether the returned blogs array should contain all blogs, including
+ * those marked 'deleted', 'archived', or 'spam'. Default false.
+ */
</ins><span class="cx"> return apply_filters( 'get_blogs_of_user', $blogs, $user_id, $all );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1095,7 +1208,14 @@
</span><span class="cx"> $output .= "</select>";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $output = apply_filters('wp_dropdown_users', $output);
</del><ins>+ /**
+ * Filter the wp_dropdown_users() HTML output.
+ *
+ * @since 2.3.0
+ *
+ * @param string $output HTML output generated by wp_dropdown_users().
+ */
+ $output = apply_filters( 'wp_dropdown_users', $output );
</ins><span class="cx">
</span><span class="cx"> if ( $echo )
</span><span class="cx"> echo $output;
</span><span class="lines">@@ -1140,9 +1260,21 @@
</span><span class="cx">
</span><span class="cx"> if ( 'edit' == $context ) {
</span><span class="cx"> if ( $prefixed ) {
</span><del>- $value = apply_filters("edit_{$field}", $value, $user_id);
</del><ins>+ /** This filter is documented in wp-includes/post.php */
+ $value = apply_filters( "edit_{$field}", $value, $user_id );
</ins><span class="cx"> } else {
</span><del>- $value = apply_filters("edit_user_{$field}", $value, $user_id);
</del><ins>+ /**
+ * Filter a user field value in the 'edit' context.
+ *
+ * The dynamic portion of the hook name, $field, refers to the prefixed user
+ * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+ *
+ * @since 2.9.0
+ *
+ * @param mixed $value Value of the prefixed user field.
+ * @param int $user_id User ID.
+ */
+ $value = apply_filters( "edit_user_{$field}", $value, $user_id );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( 'description' == $field )
</span><span class="lines">@@ -1151,16 +1283,41 @@
</span><span class="cx"> $value = esc_attr($value);
</span><span class="cx"> } else if ( 'db' == $context ) {
</span><span class="cx"> if ( $prefixed ) {
</span><del>- $value = apply_filters("pre_{$field}", $value);
</del><ins>+ /** This filter is documented in wp-includes/post.php */
+ $value = apply_filters( "pre_{$field}", $value );
</ins><span class="cx"> } else {
</span><del>- $value = apply_filters("pre_user_{$field}", $value);
</del><ins>+ /**
+ * Filter the value of a user field in the 'db' context.
+ *
+ * The dynamic portion of the hook name, $field, refers to the prefixed user
+ * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+ *
+ * @since 2.9.0
+ *
+ * @param mixed $value Value of the prefixed user field.
+ */
+ $value = apply_filters( "pre_user_{$field}", $value );
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> // Use display filters by default.
</span><del>- if ( $prefixed )
- $value = apply_filters($field, $value, $user_id, $context);
- else
- $value = apply_filters("user_{$field}", $value, $user_id, $context);
</del><ins>+ if ( $prefixed ){
+ /** This filter is documented in wp-includes/post.php */
+ $value = apply_filters( $field, $value, $user_id, $context );
+ }else{
+ /**
+ * Filter the value of a user field in a standard context.
+ *
+ * The dynamic portion of the hook name, $field, refers to the prefixed user
+ * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+ *
+ * @since 2.9.0
+ *
+ * @param mixed $value The user object value to sanitize.
+ * @param int $user_id User ID.
+ * @param string $context The context to filter within.
+ */
+ $value = apply_filters( "user_{$field}", $value, $user_id, $context );
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( 'user_url' == $field )
</span><span class="lines">@@ -1252,6 +1409,14 @@
</span><span class="cx"> function validate_username( $username ) {
</span><span class="cx"> $sanitized = sanitize_user( $username, true );
</span><span class="cx"> $valid = ( $sanitized == $username );
</span><ins>+ /**
+ * Filter whether the provided username is valid or not.
+ *
+ * @since 2.0.1
+ *
+ * @param bool $valid Whether given username is valid.
+ * @param string $username Username to check.
+ */
</ins><span class="cx"> return apply_filters( 'validate_username', $valid, $username );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1317,7 +1482,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $user_login = sanitize_user($user_login, true);
</span><del>- $user_login = apply_filters('pre_user_login', $user_login);
</del><ins>+ /**
+ * Filter a username after it has been sanitized.
+ *
+ * This filter is called before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $user_login Username after it has been sanitized.
+ */
+ $user_login = apply_filters( 'pre_user_login', $user_login );
</ins><span class="cx">
</span><span class="cx"> //Remove any non-printable chars from the login string to see if we have ended up with an empty username
</span><span class="cx"> $user_login = trim($user_login);
</span><span class="lines">@@ -1330,30 +1504,72 @@
</span><span class="cx">
</span><span class="cx"> if ( empty($user_nicename) )
</span><span class="cx"> $user_nicename = sanitize_title( $user_login );
</span><del>- $user_nicename = apply_filters('pre_user_nicename', $user_nicename);
</del><ins>+ /**
+ * Filter a user's nicename before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $user_nicename The user's nicename.
+ */
+ $user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
</ins><span class="cx">
</span><span class="cx"> if ( empty($user_url) )
</span><span class="cx"> $user_url = '';
</span><del>- $user_url = apply_filters('pre_user_url', $user_url);
</del><ins>+ /**
+ * Filter a user's URL before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $user_url The user's URL.
+ */
+ $user_url = apply_filters( 'pre_user_url', $user_url );
</ins><span class="cx">
</span><span class="cx"> if ( empty($user_email) )
</span><span class="cx"> $user_email = '';
</span><del>- $user_email = apply_filters('pre_user_email', $user_email);
</del><ins>+ /**
+ * Filter a user's email before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $user_email The user's email.
+ */
+ $user_email = apply_filters( 'pre_user_email', $user_email );
</ins><span class="cx">
</span><span class="cx"> if ( !$update && ! defined( 'WP_IMPORTING' ) && email_exists($user_email) )
</span><span class="cx"> return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) );
</span><span class="cx">
</span><span class="cx"> if ( empty($nickname) )
</span><span class="cx"> $nickname = $user_login;
</span><del>- $nickname = apply_filters('pre_user_nickname', $nickname);
</del><ins>+ /**
+ * Filter a user's nickname before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $nickname The user's nickname.
+ */
+ $nickname = apply_filters( 'pre_user_nickname', $nickname );
</ins><span class="cx">
</span><span class="cx"> if ( empty($first_name) )
</span><span class="cx"> $first_name = '';
</span><del>- $first_name = apply_filters('pre_user_first_name', $first_name);
</del><ins>+ /**
+ * Filter a user's first name before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $first_name The user's first name.
+ */
+ $first_name = apply_filters( 'pre_user_first_name', $first_name );
</ins><span class="cx">
</span><span class="cx"> if ( empty($last_name) )
</span><span class="cx"> $last_name = '';
</span><del>- $last_name = apply_filters('pre_user_last_name', $last_name);
</del><ins>+ /**
+ * Filter a user's last name before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $last_name The user's last name.
+ */
+ $last_name = apply_filters( 'pre_user_last_name', $last_name );
</ins><span class="cx">
</span><span class="cx"> if ( empty( $display_name ) ) {
</span><span class="cx"> if ( $update )
</span><span class="lines">@@ -1368,11 +1584,25 @@
</span><span class="cx"> else
</span><span class="cx"> $display_name = $user_login;
</span><span class="cx"> }
</span><ins>+ /**
+ * Filter a user's display name before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $display_name The user's display name.
+ */
</ins><span class="cx"> $display_name = apply_filters( 'pre_user_display_name', $display_name );
</span><span class="cx">
</span><span class="cx"> if ( empty($description) )
</span><span class="cx"> $description = '';
</span><del>- $description = apply_filters('pre_user_description', $description);
</del><ins>+ /**
+ * Filter a user's description before the user is created or updated.
+ *
+ * @since 2.0.3
+ *
+ * @param string $description The user's description.
+ */
+ $description = apply_filters( 'pre_user_description', $description );
</ins><span class="cx">
</span><span class="cx"> if ( empty($rich_editing) )
</span><span class="cx"> $rich_editing = 'true';
</span><span class="lines">@@ -1431,10 +1661,26 @@
</span><span class="cx"> wp_cache_delete($user_id, 'users');
</span><span class="cx"> wp_cache_delete($user_login, 'userlogins');
</span><span class="cx">
</span><del>- if ( $update )
- do_action('profile_update', $user_id, $old_user_data);
- else
- do_action('user_register', $user_id);
</del><ins>+ if ( $update ) {
+ /**
+ * Fires immediately after an existing user is updated.
+ *
+ * @since 2.0.0
+ *
+ * @param int $user_id User ID.
+ * @param object $old_user_data Object containing user's data prior to update.
+ */
+ do_action( 'profile_update', $user_id, $old_user_data );
+ } else {
+ /**
+ * Fires immediately after a new user is registered.
+ *
+ * @since 1.5.0
+ *
+ * @param int $user_id User ID.
+ */
+ do_action( 'user_register', $user_id );
+ }
</ins><span class="cx">
</span><span class="cx"> return $user_id;
</span><span class="cx"> }
</span><span class="lines">@@ -1643,6 +1889,14 @@
</span><span class="cx"> * @param string $new_pass New password for the user in plaintext
</span><span class="cx"> */
</span><span class="cx"> function reset_password( $user, $new_pass ) {
</span><ins>+ /**
+ * Fires before the user's password is reset.
+ *
+ * @since 1.5.0
+ *
+ * @param object $user The user.
+ * @param string $new_pass New user password.
+ */
</ins><span class="cx"> do_action( 'password_reset', $user, $new_pass );
</span><span class="cx">
</span><span class="cx"> wp_set_password( $new_pass, $user->ID );
</span><span class="lines">@@ -1662,6 +1916,13 @@
</span><span class="cx"> $errors = new WP_Error();
</span><span class="cx">
</span><span class="cx"> $sanitized_user_login = sanitize_user( $user_login );
</span><ins>+ /**
+ * Filter the email address of a user being registered.
+ *
+ * @since 2.1.0
+ *
+ * @param string $user_email The email address of the new user.
+ */
</ins><span class="cx"> $user_email = apply_filters( 'user_registration_email', $user_email );
</span><span class="cx">
</span><span class="cx"> // Check the username
</span><span class="lines">@@ -1684,8 +1945,35 @@
</span><span class="cx"> $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Fires when submitting registration form data, before the user is created.
+ *
+ * @since 2.1.0
+ *
+ * @param string $sanitized_user_login The submitted username after being sanitized.
+ * @param string $user_email The submitted email.
+ * @param WP_Error $errors Contains any errors with submitted username and email,
+ * e.g., an empty field, an invalid username or email,
+ * or an existing username or email.
+ */
</ins><span class="cx"> do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
</span><span class="cx">
</span><ins>+ /**
+ * Filter the errors encountered when a new user is being registered.
+ *
+ * The filtered WP_Error object may, for example, contain errors for an invalid
+ * or existing username or email address. A WP_Error object should always returned,
+ * but may or may not contain errors.
+ *
+ * If any errors are present in $errors, this will abort the user's registration.
+ *
+ * @since 2.1.0
+ *
+ * @param WP_Error $errors A WP_Error object containing any errors encountered
+ * during registration.
+ * @param string $sanitized_user_login User's username after it has been sanitized.
+ * @param string $user_email User's email.
+ */
</ins><span class="cx"> $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
</span><span class="cx">
</span><span class="cx"> if ( $errors->get_error_code() )
</span></span></pre>
</div>
</div>
</body>
</html>