Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/09/2021 06:10:51 PM (5 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-blogs/classes/class-bp-blogs-component.php

    r13093 r13123  
    433433                parent::blocks_init( $blocks );
    434434        }
     435
     436        /**
     437         * Add the Sites directory states.
     438         *
     439         * @since 10.0.0
     440         *
     441         * @param array   $states Optional. See BP_Component::admin_directory_states() for description.
     442         * @param WP_Post $post   Optional. See BP_Component::admin_directory_states() for description.
     443         * @return array          See BP_Component::admin_directory_states() for description.
     444         */
     445        public function admin_directory_states( $states = array(), $post = null ) {
     446                $bp = buddypress();
     447
     448                if ( isset( $bp->pages->blogs->id ) && (int) $bp->pages->blogs->id === (int) $post->ID ) {
     449                        $states['page_for_sites_directory'] = _x( 'BP Sites Page', 'page label', 'buddypress' );
     450                }
     451
     452                return parent::admin_directory_states( $states, $post );
     453        }
    435454}
Note: See TracChangeset for help on using the changeset viewer.