Skip to:
Content

BuddyPress.org

Changeset 13532


Ignore:
Timestamp:
07/28/2023 04:15:13 PM (3 years ago)
Author:
dcavins
Message:

Prepare for community visibility.

Reset some code changes in preparation for the new
community visibility feature.
Introduce bp_core_get_component_from_directory_page_id().

Props imath.

See #8734.

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r13520 r13532  
    670670
    671671/**
     672 * Get the component ID corresponding to a directory page ID.
     673 *
     674 * @since 12.0.0
     675 *
     676 * @param int $page_id The ID of the directory page associated with the component.
     677 * @return int|false The slug representing the component. False if none is found.
     678 */
     679function bp_core_get_component_from_directory_page_id( $page_id = 0 ) {
     680        $bp_pages = bp_core_get_directory_page_ids( 'all' );
     681
     682        $component = false;
     683        foreach ( $bp_pages as $component_id => $p_id) {
     684                if ( $page_id === $p_id ) {
     685                        $component = $component_id;
     686                        break;
     687                }
     688        }
     689
     690        return $component;
     691}
     692
     693/**
    672694 * Store the list of BP directory pages in the appropriate meta table.
    673695 *
    … …  
    970992                        array(
    971993                                'post__not_in' => array( $post_ID ),
    972                                 'post_status'  => array( 'publish', 'bp_restricted' ),
     994                                'post_status'  => bp_core_get_directory_pages_stati(),
    973995                                'post_type'    => array( 'buddypress', 'page' ),
    974996                        )
  • trunk/src/bp-core/classes/class-bp-core.php

    r13507 r13532  
    399399
    400400        /**
    401          * Set up the component post statuses.
    402          *
    403          * @since 12.0.0
    404          */
    405         public function register_post_statuses() {
    406                 register_post_status(
    407                         'bp_restricted',
    408                         array(
    409                                 'label'    => _x( 'Restricted to members', '`buddypress` post type post status', 'buddypress' ),
    410                                 'public'   => false,
    411                                 'internal' => true,
    412                         )
    413                 );
    414 
    415                 parent::register_post_statuses();
    416         }
    417 
    418         /**
    419401         * Parse the WP_Query and eventually set the BP Search mechanism.
    420402         *
Note: See TracChangeset for help on using the changeset viewer.