Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/09/2021 06:10:51 PM (4 years ago)
Author:
imath
Message:

Admin: improve information about WP pages being used as BP directories

We are now using BuddyPress specific post states to inform a WordPress page is used as the BP Component's directory page. This information is displayed into the WP Admin Pages edit screen, for menu items linking to a BP Directory into the WP Admin Menu screen as well as into the Customizer Menu section.

Fixes #8470

File:
1 edited

Legend:

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

    r13093 r13123  
    938938        );
    939939    }
     940
     941    /**
     942     * Add the Members directory states.
     943     *
     944     * @since 10.0.0
     945     *
     946     * @param array   $states Optional. See BP_Component::admin_directory_states() for description.
     947     * @param WP_Post $post   Optional. See BP_Component::admin_directory_states() for description.
     948     * @return array          See BP_Component::admin_directory_states() for description.
     949     */
     950    public function admin_directory_states( $states = array(), $post = null ) {
     951        $bp = buddypress();
     952
     953        if ( isset( $bp->pages->members->id ) && (int) $bp->pages->members->id === (int) $post->ID ) {
     954            $states['page_for_members_directory'] = _x( 'BP Members Page', 'page label', 'buddypress' );
     955        }
     956
     957        if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) {
     958            if ( isset( $bp->pages->register->id ) && (int) $bp->pages->register->id === (int) $post->ID ) {
     959                $states['page_for_bp_registration'] = _x( 'BP Registration Page', 'page label', 'buddypress' );
     960            }
     961
     962            if ( isset( $bp->pages->activate->id ) && (int) $bp->pages->activate->id === (int) $post->ID ) {
     963                $states['page_for_bp_activation'] = _x( 'BP Activation Page', 'page label', 'buddypress' );
     964            }
     965        }
     966
     967        return parent::admin_directory_states( $states, $post );
     968    }
    940969}
Note: See TracChangeset for help on using the changeset viewer.