Skip to:
Content

BuddyPress.org

Ticket #8580: 8580.1.diff

File 8580.1.diff, 3.5 KB (added by dcavins, 3 years ago)

Introduce bp_allow_access_to_registration_pages()

  • src/bp-core/admin/bp-core-admin-functions.php

    diff --git src/bp-core/admin/bp-core-admin-functions.php src/bp-core/admin/bp-core-admin-functions.php
    index 2a88837d5..ff5125048 100644
    function bp_core_activation_notice() { 
    284284
    285285        // Activate and Register are special cases. They are not components but they need WP pages.
    286286        // If user registration is disabled, we can skip this step.
    287         if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) {
     287        if ( bp_allow_access_to_registration_pages() ) {
    288288                $wp_page_components[] = array(
    289289                        'id'   => 'activate',
    290290                        'name' => __( 'Activate', 'buddypress' ),
  • src/bp-core/admin/bp-core-admin-slugs.php

    diff --git src/bp-core/admin/bp-core-admin-slugs.php src/bp-core/admin/bp-core-admin-slugs.php
    index 4701f8f46..d116eef9b 100644
    function bp_core_admin_slugs_options() { 
    187187
    188188                <h3><?php esc_html_e( 'Registration', 'buddypress' ); ?></h3>
    189189
    190                 <?php if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) : ?>
     190                <?php if ( bp_allow_access_to_registration_pages() ) : ?>
    191191                        <p>
    192192                                <?php esc_html_e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress' ); ?>
    193193                                <?php esc_html_e( 'These pages will only be reachable by users who are not logged in.', 'buddypress' ); ?>
    function bp_core_admin_slugs_options() { 
    227227                <table class="form-table">
    228228                        <tbody>
    229229
    230                                 <?php if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) : foreach ( $static_pages as $name => $label ) : ?>
     230                                <?php if ( bp_allow_access_to_registration_pages() ) : foreach ( $static_pages as $name => $label ) : ?>
    231231
    232232                                        <tr valign="top">
    233233                                                <th scope="row">
  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index e2acd9373..3dbc32f11 100644
    function bp_core_add_page_mappings( $components, $existing = 'keep' ) { 
    702702
    703703        // Register and Activate are not components, but need pages when
    704704        // registration is enabled.
    705         if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) {
     705        if ( bp_allow_access_to_registration_pages() ) {
    706706                foreach ( array( 'register', 'activate' ) as $slug ) {
    707707                        if ( ! isset( $pages[ $slug ] ) ) {
    708708                                $pages_to_create[ $slug ] = $page_titles[ $slug ];
  • src/bp-members/bp-members-template.php

    diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php
    index 2953aad11..39cfd6e65 100644
    function bp_get_members_invitations_allowed() { 
    29252925        return apply_filters( 'bp_get_members_invitations_allowed', bp_is_active( 'members', 'invitations' ) && (bool) bp_get_option( 'bp-enable-members-invitations' ) );
    29262926}
    29272927
     2928/**
     2929 * Should the system create and allow access
     2930 * to the Register and Activate pages?
     2931 *
     2932 * @since 10.0.0
     2933 *
     2934 * @return bool
     2935 */
     2936function bp_allow_access_to_registration_pages() {
     2937        $retval = bp_get_signup_allowed() || bp_get_members_invitations_allowed();
     2938
     2939        /**
     2940         * Filters whether or not the system should create and allow access
     2941         * to the Register and Activate pages.
     2942         *
     2943         * @since 10.0.0
     2944         *
     2945         * @param bool $retval Whether or not to allow access to
     2946         *                     the Register and Activate pages.
     2947         */
     2948        return apply_filters( 'bp_allow_access_to_registration_pages', $retval );
     2949}
     2950
    29282951/**
    29292952 * Hook member activity feed to <head>.
    29302953 *