BP_Nouveau::bp_change_forum_slug_on_edit_save_page( $post_id, $post )
Set the forum slug on edit page from backend.
Description
Parameters
- $post_id
-
(Required)
- $post
-
(Required)
Source
File: bp-templates/bp-nouveau/buddypress-functions.php
public function bp_change_forum_slug_on_edit_save_page( $post_id, $post ) {
// if called by autosave, then bail here
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// if this "post" post type?
if ( $post->post_type != 'page' )
return;
// does this user have permissions?
if ( ! current_user_can( 'edit_post', $post_id ) )
return;
// update!
$forum_page_id = (int) bp_get_option('_bbp_root_slug_custom_slug');
if ( $forum_page_id > 0 && $forum_page_id === $post_id ) {
$slug = get_post_field( 'post_name', $post_id );
if ( '' !== $slug ) {
bp_update_option( '_bbp_root_slug', $slug );
bp_update_option( 'rewrite_rules', '' );
}
}
}
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.