[wp-trac] [WordPress Trac] #45197: Introduce `user_can_for_blog()`

WordPress Trac noreply at wordpress.org
Mon Sep 30 17:13:56 UTC 2024


#45197: Introduce `user_can_for_blog()`
-----------------------------+--------------------------
 Reporter:  johnbillion      |       Owner:  johnbillion
     Type:  enhancement      |      Status:  reopened
 Priority:  normal           |   Milestone:  6.7
Component:  Role/Capability  |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  multisite
-----------------------------+--------------------------

Comment (by flixos90):

 I don't think it's documented anywhere, but that doesn't mean it's not
 true. That said, I see the concern outlined by @johnbillion in terms of
 consistency. I agree that we should avoid having
 `current_user_can_for_blog()` and `user_can_for_site()` coexist as the two
 recommended functions.

 I don't like introducing a new function using the old naming convention,
 but the consistency between two functions as closely related as these two
 would be is also important.

 I see two alternative paths here:
 * Either we settle for introducing a new function under the old name and
 go with `user_can_for_blog()`.
 * Or we clean this up by deprecating `current_user_can_for_blog()` in
 favor of `current_user_can_for_site()`, and then introduce
 `user_can_for_site()`.

 The latter means there will be deprecation messages, which is always a bit
 annoying especially when it's just for renaming. But in the long term it's
 the better choice.

 I think I'm personally slightly leaning towards the latter, but curious
 what others think.

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


More information about the wp-trac mailing list