bp_core_admin_maybe_save_pages_settings()
Save BuddyBoss pages settings
Description
Return
(bool)
Source
File: bp-core/admin/bp-core-admin-pages.php
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.