Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/02/2023 02:05:08 AM (3 years ago)
Author:
imath
Message:

Prevent potential issues with late_includes() in Component classes

Use require_once instead of require to load action & screen files.

See #4954
Fixes #8910
Closes https://github.com/buddypress/buddypress/pull/112

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-members-component.php

    r13492 r13495  
    152152            // Actions - Random member handler.
    153153            if ( isset( $_GET['random-member'] ) ) {
    154                 require $this->path . 'bp-members/actions/random.php';
     154                require_once $this->path . 'bp-members/actions/random.php';
    155155            }
    156156
    157157            // Screens - Directory.
    158158            if ( bp_is_members_directory() ) {
    159                 require $this->path . 'bp-members/screens/directory.php';
     159                require_once $this->path . 'bp-members/screens/directory.php';
    160160            }
    161161        }
     
    163163        // Members - User main nav screen.
    164164        if ( bp_is_user() ) {
    165             require $this->path . 'bp-members/screens/profile.php';
     165            require_once $this->path . 'bp-members/screens/profile.php';
    166166
    167167            // Action - Delete avatar.
    168168            if ( is_user_logged_in()&& bp_is_user_change_avatar() && bp_is_action_variable( 'delete-avatar', 0 ) ) {
    169                 require $this->path . 'bp-members/actions/delete-avatar.php';
     169                require_once $this->path . 'bp-members/actions/delete-avatar.php';
    170170            }
    171171
     
    174174                in_array( bp_current_action(), array( 'change-avatar', 'change-cover-image' ), true )
    175175            ) {
    176                 require $this->path . 'bp-members/screens/' . bp_current_action() . '.php';
     176                require_once $this->path . 'bp-members/screens/' . bp_current_action() . '.php';
    177177            }
    178178        }
     
    186186        if ( bp_is_register_page() || bp_is_activation_page() ) {
    187187            if ( bp_is_register_page() ) {
    188                 require $this->path . 'bp-members/screens/register.php';
     188                require_once $this->path . 'bp-members/screens/register.php';
    189189            } else {
    190                 require $this->path . 'bp-members/screens/activate.php';
     190                require_once $this->path . 'bp-members/screens/activate.php';
    191191            }
    192192
     
    199199            // Actions.
    200200            if ( isset( $_POST['members_invitations'] ) ) {
    201                 require $this->path . 'bp-members/actions/invitations-bulk-manage.php';
     201                require_once $this->path . 'bp-members/actions/invitations-bulk-manage.php';
    202202            }
    203203
    204204            // Screens.
    205             require $this->path . 'bp-members/screens/invitations.php';
     205            require_once $this->path . 'bp-members/screens/invitations.php';
    206206        }
    207207    }
Note: See TracChangeset for help on using the changeset viewer.