Add WP_DISABLE_COLLABORATION constant#11311
Add WP_DISABLE_COLLABORATION constant#11311alecgeatches wants to merge 3 commits intoWordPress:trunkfrom
Conversation
…_enabled() function
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
I have a few of suggestions.
- Instead of a constant with a negative intent, it is clearer to use a positive intent. This avoids having code along the lines of
if ( CONSTANT === true ) then false; - It's more precise to describe the constant as whether or not RTC is permitted, than whether RTC is enabled or disabled. I think
WP_ALLOW_COLLABORATIONis a better match for that intent. - As a part of the consideration is to allow hosts to disallow the feature at an environment level, allowing an environment variable to be set will help meet their needs
- Instead of needing to repeat the
! defined() && ..., define the default value inwp_functionality_constants()
My suggestion is to add the following to wp_functionality_constants() and modify the PR for the various implications
/**
* Whether real time collaboration is permitted to be enabled.
*
* @since 7.0.0
*/
if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
if ( false !== getenv( 'WP_ALLOW_COLLABORATION' ) ) {
// Environment variable is defined.
if ( 'true' === getenv( 'WP_ALLOW_COLLABORATION' ) ) {
define( 'WP_ALLOW_COLLABORATION', true );
} else {
define( 'WP_ALLOW_COLLABORATION', false );
}
} else {
// Environment variable is not defined, default to true.
define( 'WP_ALLOW_COLLABORATION', true );
}
}
Add
WP_DISABLE_COLLABORATIONconstant and wrapperwp_is_collaboration_enabled()function. Based on UI changes in #11310.WP_DISABLE_COLLABORATIONonly has a function when it is set totrue. Otherwise, the feature can be disabled or enabled via the existing Settings -> Writing checkbox.Trac ticket: https://core.trac.wordpress.org/ticket/64904
Screenshots
With
With
or no
WP_DISABLE_COLLABORATIONconfiguration at all, the default checkbox:Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.6
Used for: Implementation