Making WordPress.org

Changeset 4961


Ignore:
Timestamp:
02/20/2017 11:23:20 PM (8 years ago)
Author:
ocean90
Message:

WordPress.org SSO: Inherit the 'registration' option from the main network.

See #148.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/wporg-sso/wp-plugin.php

    r4957 r4961  
    5555                add_filter( 'password_change_email', array( $this, 'replace_admin_email_in_change_emails' ) );
    5656                add_filter( 'email_change_email', array( $this, 'replace_admin_email_in_change_emails' ) );
    57             }
     57
     58                add_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
     59            }
     60        }
     61
     62        /**
     63         * Inherits the 'registration' option from the main network.
     64         *
     65         * @return string Current registration status.
     66         */
     67        public function inherit_registration_option() {
     68            remove_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
     69            $value = get_network_option( 1, 'registration', 'none' );
     70            add_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
     71            return $value;
    5872        }
    5973
Note: See TracChangeset for help on using the changeset viewer.