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-core/classes/class-bp-component.php

    r13108 r13123  
    510510                }
    511511
     512                // Set directory page states.
     513                add_filter( 'bp_admin_display_directory_states', array( $this, 'admin_directory_states' ), 10, 2 );
     514
    512515                /**
    513516                 * Fires at the end of the setup_actions method inside BP_Component.
    … …  
    988991                do_action( 'bp_' . $this->id . '_blocks_init' );
    989992        }
     993
     994        /**
     995         * Add component's directory states.
     996         *
     997         * @since 10.0.0
     998         *
     999         * @param string[] $states An array of post display states.
     1000         * @param WP_Post  $post   The current post object.
     1001         * @return array           The component's directory states.
     1002         */
     1003        public function admin_directory_states( $states = array(), $post = null ) {
     1004                if ( $this->has_directory ) {
     1005                        /**
     1006                         * Filter here to edit the component's directory states.
     1007                         *
     1008                         * This is a dynamic hook that is based on the component string ID.
     1009                         *
     1010                         * @since 10.0.0
     1011                         *
     1012                         * @param string[] $states An array of post display states.
     1013                         */
     1014                        return apply_filters( 'bp_' . $this->id . '_admin_directory_states', $states );
     1015                }
     1016
     1017                return $states;
     1018        }
    9901019}
    9911020endif; // BP_Component.
Note: See TracChangeset for help on using the changeset viewer.