Make WordPress Core

Opened 15 years ago

Closed 14 years ago

Last modified 12 years ago

#12381 closed defect (bug) (fixed)

Switch away from constants to filters for {en|dis}abling and configuring features

Reported by: westi's profile westi Owned by: westi's profile 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)

#1 @westi
15 years ago

(In [13413]) Disable update service editing by default for multisite. See #12229.
Introduce return_false for simple filtering. See #12381.

#2 @westi
15 years ago

(In [13416]) Switch from POST_BY_EMAIL constant to enable post-by-email when multisite to a filter. See #12381.

#3 @westi
15 years ago

(In [13418]) Switch from POST_BY_EMAIL constant to enable post-by-email when multisite to a filter. See #12381.

#4 @ocean90
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 @nacin
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 @dd32
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 @ocean90
15 years ago

Yes it works now, in the first post there is still ..._of_... in the name. So I use the wrong name.

#8 follow-up: @nacin
15 years ago

(In [13526]) Add return_true() to complement return_false(). see #12381

#9 in reply to: ↑ 8 ; follow-up: @Denis-de-Bernardy
15 years ago

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().

#10 @nacin
15 years ago

In [13568]

Switch the multisite constant EDIT_ANY_USER to a filter. Also ensure we're back compat with POST_BY_EMAIL. see #12381

#11 in reply to: ↑ 9 @westi
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 @westi
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

I believe we can close this as fixed.

#13 @juliobox
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

#14 @juliobox
12 years ago

  • Cc juliobosk@… added
Note: See TracTickets for help on using tickets.