Skip to:
Content

bbPress.org

Changeset 5655


Ignore:
Timestamp:
03/24/2015 08:28:20 AM (7 years ago)
Author:
netweb
Message:

Forums: Fix missing meta data during new forum creation

  • Call bbp_open_forum() if the forum is "open" to add the forum _bbp_status = open meta
  • Call bbp_normalize_forum() if the forum is a "forum" to add the forum _bbp_forum_type = forum meta

Props netweb. Fixes #2647

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/functions.php

    r5502 r5655  
    632632    /** Forum Status ******************************************************/
    633633
    634     if ( !empty( $_POST['bbp_forum_status'] ) && in_array( $_POST['bbp_forum_status'], array( 'open', 'closed' ) ) ) {
    635         if ( 'closed' === $_POST['bbp_forum_status'] && !bbp_is_forum_closed( $forum_id, false ) ) {
     634    if ( ! empty( $_POST['bbp_forum_status'] ) && in_array( $_POST['bbp_forum_status'], array( 'open', 'closed' ) ) ) {
     635        if ( 'closed' === $_POST['bbp_forum_status'] && ! bbp_is_forum_closed( $forum_id, false ) ) {
    636636            bbp_close_forum( $forum_id );
     637        } elseif ( 'open' === $_POST['bbp_forum_status'] && bbp_is_forum_open( $forum_id, false ) ) {
     638            bbp_open_forum( $forum_id );
    637639        } elseif ( 'open' === $_POST['bbp_forum_status'] && bbp_is_forum_closed( $forum_id, false ) ) {
    638640            bbp_open_forum( $forum_id );
     
    642644    /** Forum Type ********************************************************/
    643645
    644     if ( !empty( $_POST['bbp_forum_type'] ) && in_array( $_POST['bbp_forum_type'], array( 'forum', 'category' ) ) ) {
    645         if ( 'category' === $_POST['bbp_forum_type'] && !bbp_is_forum_category( $forum_id ) ) {
     646    if ( ! empty( $_POST['bbp_forum_type'] ) && in_array( $_POST['bbp_forum_type'], array( 'forum', 'category' ) ) ) {
     647        if ( 'category' === $_POST['bbp_forum_type'] && ! bbp_is_forum_category( $forum_id ) ) {
    646648            bbp_categorize_forum( $forum_id );
     649        } elseif ( 'forum' === $_POST['bbp_forum_type'] && ! bbp_is_forum_category( $forum_id ) ) {
     650            bbp_normalize_forum( $forum_id );
    647651        } elseif ( 'forum' === $_POST['bbp_forum_type'] && bbp_is_forum_category( $forum_id ) ) {
    648652            bbp_normalize_forum( $forum_id );
Note: See TracChangeset for help on using the changeset viewer.