[wp-trac] [WordPress Trac] #49102: Multisite: removed_user_from_blog hook

WordPress Trac noreply at wordpress.org
Tue Dec 31 09:21:06 UTC 2019


#49102: Multisite: removed_user_from_blog hook
-----------------------------+-----------------------------
 Reporter:  kevinu           |       Owner:  SergeyBiryukov
     Type:  feature request  |      Status:  reviewing
 Priority:  normal           |   Milestone:  5.4
Component:  Users            |     Version:  5.3.2
 Severity:  minor            |  Resolution:
 Keywords:                   |     Focuses:  multisite
-----------------------------+-----------------------------

Comment (by kevinu):

 Hello @SergeyBiryukov, and thank you for the welcoming and your review!

 That makes a lot of sense and I think it should definitely be kept
 somewhat consistent between these four functions. So I have uploaded
 [attachment:"49102.2.patch"] which includes making the suggested changes 1
 & 2.

 While working on it I noticed three other discrepancies I wanted to bring
 up and and if you feel these should be addressed I would be happy to add
 it into this patch as well.

 1. The already present actions `add_user_to_blog` and
 `remove_user_from_blog` as well as my addition of `removed_user_from_blog`
 all use the terms "to_blog" or "from_blog".

 Should the action `added_existing_user` in `add_existing_user_to_blog()`
 and `added_new_user` in `add_new_user_to_blog()` also share that same

 2. All the actions current and suggested provide the arguments of
 `$user_id` and `$blog_id`, (some providing $role as well) except for
 `added_existing_user`. This provides the arguments `$user_id` and
 `$result`.

 I feel as though the name `added_existing_user` already implies a success.
 Should this be changed to be surrounded in an if-statement and provide
 `$blog_id` like the others?

 3. I noticed that in `remove_user_from_blog()` and it's action
 `remove_user_from_blog` the doc-blocks refer to `$blog_id` being an (int).
 But it actually comes through as a string.

 We could either update the doc-blocks, or type cast it as (int) like we do
 to `$user_id` in that same function perhaps?
 If this one needs to be tracked in a separate ticket I could do so.

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


More information about the wp-trac mailing list