Skip to:
Content

bbPress.org

Changeset 5517


Ignore:
Timestamp:
09/13/2014 03:07:28 AM (11 years ago)
Author:
netweb
Message:

In bbPress 1.x converter add support for closed topics via improved method in r5425.
Props netweb. Fixes #2125.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/converters/bbPress1.php

    r5516 r5517  
    237237        );
    238238
     239        // Topic status (Publish or Closed to new replies)
     240        $this->field_map[] = array(
     241            'from_tablename'  => 'topics',
     242            'from_fieldname'  => 'topic_open',
     243            'to_type'         => 'topic',
     244            'to_fieldname'    => '_bbp_old_closed_status_id',
     245            'callback_method' => 'callback_topic_status'
     246        );
     247
    239248        // Topic author ip (Stored in postmeta)
    240249        // Note: We join the 'posts' table because 'topics' table does not include author ip.
     
    574583
    575584    /**
     585     * Translate the topic status from bbPress 1's numeric's to WordPress's
     586     * strings.
     587     *
     588     * @param int $topic_status bbPress 1.x numeric status
     589     * @return string WordPress safe
     590     */
     591    public function callback_topic_status( $topic_status = 1 ) {
     592        switch ( $topic_status ) {
     593            case 0 :
     594                $topic_status = 'closed';  // bbp_get_closed_status_id()
     595                break;
     596
     597            case 1 :
     598                default :
     599                $topic_status = 'publish'; // bbp_get_public_status_id()
     600                break;
     601        }
     602        return $topic_status;
     603    }
     604
     605    /**
    576606     * Translate the topic sticky status type from bbPress 1.x numeric's to WordPress's strings.
    577607     *
Note: See TracChangeset for help on using the changeset viewer.