Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/01/2011 09:01:00 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Fix issue where post form values would disappear when editing or creating a new topic. Addresses topic portion of #1466.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-functions.php

    r2975 r2976  
    7373
    7474                // Handle Title
    75                 if ( empty( $_POST['bbp_topic_title'] ) || !$topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ) )
     75                if ( isset( $_POST['bbp_topic_title'] ) && ( !$topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ) ) )
    7676                        $bbp->errors->add( 'bbp_topic_title', __( '<strong>ERROR</strong>: Your topic needs a title.', 'bbpress' ) );
    7777
     
    7979
    8080                // Handle Content
    81                 if ( empty( $_POST['bbp_topic_content'] ) || !$topic_content = $_POST['bbp_topic_content'] )
     81                if ( isset( $_POST['bbp_topic_content'] ) && ( !$topic_content = $_POST['bbp_topic_content'] ) )
    8282                        $bbp->errors->add( 'bbp_topic_content', __( '<strong>ERROR</strong>: Your topic needs some content.', 'bbpress' ) );
    8383
     
    8585
    8686                // Handle Forum id to append topic to
    87                 if ( empty( $_POST['bbp_forum_id'] ) || !$forum_id = $_POST['bbp_forum_id'] ) {
     87                if ( isset( $_POST['bbp_forum_id'] ) && ( !$forum_id = $_POST['bbp_forum_id'] ) ) {
    8888                        $bbp->errors->add( 'bbp_topic_forum_id', __( '<strong>ERROR</strong>: Forum ID is missing.', 'bbpress' ) );
    8989                } else {
     
    108108                // Handle Tags
    109109                if ( !empty( $_POST['bbp_topic_tags'] ) ) {
     110
    110111                        // Escape tag input
    111112                        $terms = esc_attr( strip_tags( $_POST['bbp_topic_tags'] ) );
     
    254255
    255256                // Handle Forum id to append topic to
    256                 if ( empty( $_POST['bbp_forum_id'] ) || !$forum_id = $_POST['bbp_forum_id'] ) {
     257                if ( isset( $_POST['bbp_forum_id'] ) && ( !$forum_id = $_POST['bbp_forum_id'] ) ) {
    257258                        $bbp->errors->add( 'bbp_topic_forum_id', __( '<strong>ERROR</strong>: Forum ID is missing.', 'bbpress' ) );
    258259                } elseif ( $forum_id != $topic->post_parent ) {
     
    268269
    269270                // Handle Title
    270                 if ( empty( $_POST['bbp_topic_title'] ) || !$topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ) )
     271                if ( isset( $_POST['bbp_topic_title'] ) && ( !$topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ) ) )
    271272                        $bbp->errors->add( 'bbp_edit_topic_title', __( '<strong>ERROR</strong>: Your topic needs a title.', 'bbpress' ) );
    272273
     
    274275
    275276                // Handle Content
    276                 if ( empty( $_POST['bbp_topic_content'] ) || !$topic_content = $_POST['bbp_topic_content'] )
     277                if ( isset( $_POST['bbp_topic_content'] ) && ( !$topic_content = $_POST['bbp_topic_content'] ) )
    277278                        $bbp->errors->add( 'bbp_edit_topic_content', __( '<strong>ERROR</strong>: Your topic cannot be empty.', 'bbpress' ) );
    278279
Note: See TracChangeset for help on using the changeset viewer.