Skip to:
Content

BuddyPress.org

Changeset 11154


Ignore:
Timestamp:
09/22/2016 01:46:54 AM (10 years ago)
Author:
r-a-y
Message:

Members: Simplify bp_get_signup_allowed().

We only need to call bp_get_option( 'users_can_register' ) for both
single-site and multisite as multisite already filters the
'users_can_register' option:
https://core.trac.wordpress.org/browser/tags/4.6.1/src/wp-includes/ms-default-filters.php#L20
https://core.trac.wordpress.org/browser/tags/4.6.1/src/wp-includes/ms-functions.php#L2104

See #7193.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-template.php

    r11149 r11154  
    25082508         */
    25092509        function bp_get_signup_allowed() {
    2510                 $bp = buddypress();
    2511 
    2512                 $signup_allowed = false;
    2513 
    2514                 if ( is_multisite() ) {
    2515                         $registration = bp_core_get_root_option( 'registration' );
    2516 
    2517                         if ( in_array( $registration, array( 'all', 'user' ) ) ) {
    2518                                 $signup_allowed = true;
    2519                         }
    2520 
    2521                 } else {
    2522                         if ( bp_get_option( 'users_can_register') ) {
    2523                                 $signup_allowed = true;
    2524                         }
    2525                 }
    2526 
    25272510                /**
    25282511                 * Filters whether or not new signups are allowed.
     
    25322515                 * @param bool $signup_allowed Whether or not new signups are allowed.
    25332516                 */
    2534                 return apply_filters( 'bp_get_signup_allowed', $signup_allowed );
     2517                return apply_filters( 'bp_get_signup_allowed', (bool) bp_get_option( 'users_can_register' ) );
    25352518        }
    25362519
Note: See TracChangeset for help on using the changeset viewer.