From 004fbf2589bcb4b072510e367f3b8ae5f7e5438d Mon Sep 17 00:00:00 2001
From: Kevin Ullyott <ullyott.kevin@gmail.com>
Date: Mon, 30 Dec 2019 17:22:06 -0800
Subject: [PATCH] Add removed_user_from_blog action hook
Adds an action hook to remove_user_from_blog for after the succesful removal of a user from a blog
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
added_user_to_blog action hook to add_user_to_blog
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
Update removed_user_from_blog @since
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
added_new_user action hook to add_new_user_to_blog
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
---
src/wp-includes/ms-functions.php | 37 +++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
index 43325c0cac..d53a53980c 100644
|
|
|
function add_user_to_blog( $blog_id, $user_id, $role ) { |
| 213 | 213 | do_action( 'add_user_to_blog', $user_id, $role, $blog_id ); |
| 214 | 214 | |
| 215 | 215 | clean_user_cache( $user_id ); |
| 216 | | wp_cache_delete( $blog_id . '_user_count', 'blog-details' ); |
| | 216 | wp_cache_delete( $blog_id . '_user_count', 'blog-details' ); |
| | 217 | |
| | 218 | /** |
| | 219 | * Fires immediately after a user is added to a site, and after the user cache has been cleaned. |
| | 220 | * |
| | 221 | * @since MU (5.4.0) |
| | 222 | * |
| | 223 | * @param int $user_id User ID. |
| | 224 | * @param string $role User role. |
| | 225 | * @param int $blog_id Blog ID. |
| | 226 | */ |
| | 227 | do_action( 'added_user_to_blog', $user_id, $role, $blog_id ); |
| 217 | 228 | |
| 218 | 229 | restore_current_blog(); |
| 219 | 230 | |
| … |
… |
function remove_user_from_blog( $user_id, $blog_id = '', $reassign = '' ) { |
| 303 | 314 | } |
| 304 | 315 | } |
| 305 | 316 | |
| 306 | | restore_current_blog(); |
| | 317 | /** |
| | 318 | * Fires after a user is removed from a site. |
| | 319 | * |
| | 320 | * @since MU (5.4.0) |
| | 321 | * |
| | 322 | * @param int $user_id User ID. |
| | 323 | * @param int $blog_id Blog ID. |
| | 324 | */ |
| | 325 | do_action( 'removed_user_from_blog', $user_id, $blog_id ); |
| | 326 | |
| | 327 | restore_current_blog(); |
| 307 | 328 | |
| 308 | 329 | return true; |
| 309 | 330 | } |
| … |
… |
function add_new_user_to_blog( $user_id, $password, $meta ) { |
| 2185 | 2206 | $result = add_user_to_blog( $blog_id, $user_id, $role ); |
| 2186 | 2207 | |
| 2187 | 2208 | if ( ! is_wp_error( $result ) ) { |
| 2188 | | update_user_meta( $user_id, 'primary_blog', $blog_id ); |
| | 2209 | update_user_meta( $user_id, 'primary_blog', $blog_id ); |
| | 2210 | |
| | 2211 | /** |
| | 2212 | * Fires immediately after a new user is added to a site. |
| | 2213 | * |
| | 2214 | * @since MU (5.4.0) |
| | 2215 | * |
| | 2216 | * @param int $user_id User ID. |
| | 2217 | * @param int $blog_id Blog ID. |
| | 2218 | */ |
| | 2219 | do_action( 'added_new_user', $user_id, $blog_id ); |
| 2189 | 2220 | } |
| 2190 | 2221 | } |
| 2191 | 2222 | } |