#12381 closed defect (bug) (fixed)
Switch away from constants to filters for {en|dis}abling and configuring features
Reported by: | westi | Owned by: | westi |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Inspired by #12229.
Basically we should do:
<?php if ( apply_filters('enable_configuration_of_update_services', true) ) {
rather than
<?php if ( !is_multisite() || ( defined( 'UPDATE_SERVICES' ) && UPDATE_SERVICES ) ) {
We don't need to make this check multisite specific.
Change History (14)
#4
@
15 years ago
And how we can enable it now?
I try
function __return_true() { return true; } add_filter('enable_configuration_of_update_services', '__return_true'); // or add_filter('enable_configuration_of_update_services', true);
But it doesn't appears.
And if I change
<?php if ( apply_filters( 'enable_update_services_configuration', true) ) { ?>
to
<?php if ( apply_filters( 'enable_update_services_configuration', false ) ) { ?>
it's hide too.
#5
@
15 years ago
Westi didn't add a __return_true()
function. Also, note the name of the filter. In this case, you can simply remove the default MS filter with remove_filter().
#6
@
15 years ago
I try
Try:
remove_filter( 'enable_update_services_configuration', '__return_false' );
or set the priotity higher than the default hooks.
add_filter('enable_configuration_of_update_services', '__return_true', 100);
#7
@
15 years ago
Yes it works now, in the first post there is still ..._of_... in the name. So I use the wrong name.
#11
in reply to:
↑ 9
@
15 years ago
Replying to Denis-de-Bernardy:
Replying to nacin:
(In [13526]) Add return_true() to complement return_false(). see #12381
how about renaming those two functions as simply true() and false().
Because I prefer to name the functions with a clear meaning so that it is obvious that you are calling a function.
#12
@
14 years ago
- Resolution set to fixed
- Status changed from new to closed
I believe we can close this as fixed.
#13
@
12 years ago
Hi all
So, what is expected here : when we set up the EDIT_ANY_USER constant on TRUE, a network administrator can edit his own users, right ? Same has setting up the filter "enable_edit_any_user_configuration" to "false".
But according to the core code, this is not possible. Network Administrators are not able to edit users.
If it's designed like this, i think this constant and filter are confusing. According to my researchs, nobody can use it, everybody used a plugin or a hack from Justin Tadlock.
So now, is it a bug ? do we have to delete this ? What's coming up with this ?
Thank you
(In [13413]) Disable update service editing by default for multisite. See #12229.
Introduce return_false for simple filtering. See #12381.