bp_core_admin_maybe_save_pages_settings()
Save BuddyBoss pages settings
Description
Return
(bool)
Source
File: bp-core/admin/bp-core-admin-pages.php
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | function bp_core_admin_maybe_save_pages_settings() { if ( ! isset( $_GET [ 'page' ] ) || ! isset( $_POST [ 'submit' ] ) ) { return false; } if ( 'bp-pages' != $_GET [ 'page' ] ) { return false; } if ( ! check_admin_referer( 'bp-pages-options' ) ) { return false; }; if ( isset( $_POST [ 'bp_pages' ] ) ) { $valid_pages = array_merge ( bp_core_admin_get_directory_pages(), bp_core_admin_get_static_pages() ); $new_directory_pages = array (); foreach ( ( array ) $_POST [ 'bp_pages' ] as $key => $value ) { // Exclude the new_forums_page to set in $new_directory_pages array. if ( isset( $valid_pages [ $key ] ) && 'new_forums_page' !== $key ) { $new_directory_pages [ $key ] = (int) $value ; } } bp_core_update_directory_page_ids( $new_directory_pages ); // Save the forums page id into the _bbp_root_slug_custom_slug option and set the forum root slug to selected page slug. if ( bp_is_active( 'forums' ) ) { if ( isset( $_POST [ 'bp_pages' ] ) && '' === $_POST [ 'bp_pages' ][ 'new_forums_page' ] ) { bp_update_option( '_bbp_root_slug_custom_slug' , '' ); } else { $slug = get_post_field( 'post_name' , (int) $_POST [ 'bp_pages' ][ 'new_forums_page' ] ); bp_update_option( '_bbp_root_slug' , $slug ); bp_update_option( '_bbp_root_slug_custom_slug' , (int) $_POST [ 'bp_pages' ][ 'new_forums_page' ] ); } } } bp_core_redirect( bp_get_admin_url( add_query_arg( array ( 'page' => 'bp-pages' , 'added' => 'true' ) , 'admin.php' ) ) ); } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.