[wp-trac] [WordPress Trac] #41757: Add action inside of add_new_user_to_blog() function

WordPress Trac noreply at wordpress.org
Sat Mar 8 16:47:12 UTC 2025


#41757: Add action inside of add_new_user_to_blog() function
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  low                                  |   Milestone:  Future
                                                 |  Release
Component:  Users                                |     Version:  3.0
 Severity:  minor                                |  Resolution:
 Keywords:  has-patch has-testing-info dev-      |     Focuses:  multisite
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing => has-patch has-testing-info dev-
     feedback


Comment:

 == Combined Test Report

 === Description
 This report validates that the patch works as expected using a test plugin
 for the hook.

 To the original patch: https://core.trac.wordpress.org/raw-
 attachment/ticket/41757/ms-functions.diff
 There have been minor mods in the file after 8 years, so I have submitted
 a Github PR with the patch. So this is the current patch tested here:
 https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-
 develop/pull/8476.diff

 === Environment
 - WordPress: 6.8-beta1-59933-src
 - PHP: 8.2.27
 - Server: nginx/1.27.4
 - Database: mysqli (Server: 8.4.4 / Client: mysqlnd 8.2.27)
 - Browser: Chrome 133.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.1
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Use-Case Reproduction
 1. First we need to set up a multisite.
 2. Second, we can create a second site for diversity. We are going to be
 working in this testing with `id = 2`
 3. I have created an ad-hoc plugin to test and showcase a couple **use-
 cases** of this hook:
 https://github.com/SirLouen/testing-41757/archive/refs/tags/1.0.1.zip
 4. This plugin adds 3 simple use-cases
         1. It displays a log record with the data
         2. It adds some metadata based on the network blog
         3. It adds some extra capabilities
 5. We simply create a new user in the new network blog (must be `id = 2`).
 6. We check in `wp-content` the `user-blog-additions.log`
 ```
 # cat user-blog-additions.log
 [2025-03-08 16:34:08] User ID: 3 was added to Blog ID: 2 with role:
 subscriber and password ODf8YH7j1sSO
 ```
 7. We check the database in `wp_usermeta` to check for a record with
 `user_id` = 3 `date_added_to_blog_2` and current date
 8. Same for `wp_2_capabilities` and two roles: `subscriber` (or whatever
 we gave on use creation) and `access_premium_content`

 === Actual Results
 1.  ✅ Use-cases can be proven with this patch.

 === Supplemental Artifacts
 All the required artifacts have been linked in the corresponding tests.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41757#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list