Changeset 13123
- Timestamp:
- 10/09/2021 06:10:51 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-component.php
r13093 r13123 547 547 parent::blocks_init( $blocks ); 548 548 } 549 550 /** 551 * Add the Activity directory state. 552 * 553 * @since 10.0.0 554 * 555 * @param array $states Optional. See BP_Component::admin_directory_states() for description. 556 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description. 557 * @return array See BP_Component::admin_directory_states() for description. 558 */ 559 public function admin_directory_states( $states = array(), $post = null ) { 560 $bp = buddypress(); 561 562 if ( isset( $bp->pages->activity->id ) && (int) $bp->pages->activity->id === (int) $post->ID ) { 563 $states['page_for_activity_directory'] = _x( 'BP Activity Page', 'page label', 'buddypress' ); 564 } 565 566 return parent::admin_directory_states( $states, $post ); 567 } 549 568 } -
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13093 r13123 433 433 parent::blocks_init( $blocks ); 434 434 } 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 } 435 454 } -
trunk/src/bp-core/admin/bp-core-admin-actions.php
r12606 r13123 60 60 add_action( 'bp_admin_menu', 'bp_admin_separator' ); 61 61 62 // Add a filter to include BP Components directory pages display states. 63 add_filter( 'display_post_states', 'bp_admin_display_directory_states', 10, 2 ); 64 62 65 /** 63 66 * When a new site is created in a multisite installation, run the activation … … 235 238 do_action( 'bp_register_admin_settings' ); 236 239 } 240 241 /** 242 * Dedicated filter to inform about BP components directory page states. 243 * 244 * @since 10.0.0 245 * 246 * @param string[] $post_states An array of post display states. 247 * @param WP_Post $post The current post object. 248 */ 249 function bp_admin_display_directory_states( $post_states = array(), $post = null ) { 250 /** 251 * Filter here to add BP Directory pages. 252 * 253 * Used internaly by BP_Component->admin_directory_states(). Please use the dynamic 254 * filter in BP_Component->admin_directory_states() to edit the directory state 255 * according to the component's ID. 256 * 257 * @since 10.0.0 258 * 259 * @param array $value An empty array. 260 * @param WP_Post $post The current post object. 261 */ 262 $directory_page_states = apply_filters( 'bp_admin_display_directory_states', array(), $post ); 263 264 if ( $directory_page_states ) { 265 $post_states = array_merge( $post_states, $directory_page_states ); 266 } 267 268 return $post_states; 269 } -
trunk/src/bp-core/classes/class-bp-component.php
r13108 r13123 510 510 } 511 511 512 // Set directory page states. 513 add_filter( 'bp_admin_display_directory_states', array( $this, 'admin_directory_states' ), 10, 2 ); 514 512 515 /** 513 516 * Fires at the end of the setup_actions method inside BP_Component. … … 988 991 do_action( 'bp_' . $this->id . '_blocks_init' ); 989 992 } 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 } 990 1019 } 991 1020 endif; // BP_Component. -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13103 r13123 1135 1135 ); 1136 1136 } 1137 1138 /** 1139 * Add the Groups directory states. 1140 * 1141 * @since 10.0.0 1142 * 1143 * @param array $states Optional. See BP_Component::admin_directory_states() for description. 1144 * @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description. 1145 * @return array See BP_Component::admin_directory_states() for description. 1146 */ 1147 public function admin_directory_states( $states = array(), $post = null ) { 1148 $bp = buddypress(); 1149 1150 if ( isset( $bp->pages->groups->id ) && (int) $bp->pages->groups->id === (int) $post->ID ) { 1151 $states['page_for_groups_directory'] = _x( 'BP Groups Page', 'page label', 'buddypress' ); 1152 } 1153 1154 return parent::admin_directory_states( $states, $post ); 1155 } 1137 1156 } -
trunk/src/bp-members/classes/class-bp-members-component.php
r13093 r13123 938 938 ); 939 939 } 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 } 940 969 }
Note: See TracChangeset
for help on using the changeset viewer.