bp_core_set_default_pages()
Set default pages for Privacy Policy, Terms of Service, Activate and Register
Description
Source
File: bp-core/bp-core-functions.php
function bp_core_set_default_pages() { $page_ids = bp_core_get_directory_page_ids( 'all' ); $valid_pages = array_merge( bp_core_admin_get_directory_pages(), bp_core_admin_get_static_pages() ); $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); if ( ! bp_get_signup_allowed() ) { unset( $valid_pages['activate'] ); unset( $valid_pages['register'] ); } // Remove Terms of Service page from auto-creation on installation. unset( $valid_pages['terms'] ); foreach ( $valid_pages as $key => $value ) { if ( ! array_key_exists( $key, $page_ids ) ) { $default_title = bp_core_get_directory_page_default_titles(); if ( 'privacy' === $key && $policy_page_id > 0 ) { $page_ids[ $key ] = (int) $policy_page_id; } else { $title = ( isset( $default_title[ $key ] ) ) ? $default_title[ $key ] : $value; $new_page = array( 'post_title' => $title, 'post_status' => 'publish', 'post_author' => bp_loggedin_user_id(), 'post_type' => 'page', 'comment_status' => 'closed', 'ping_status' => 'closed', ); $page_id = wp_insert_post( $new_page ); $page_ids[ $key ] = (int) $page_id; } bp_core_update_directory_page_ids( $page_ids ); } } }
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.