Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/23/2013 11:19:34 AM (12 years ago)
Author:
netweb
Message:

Include 'sticky' and 'super sticky' import capabilities for the following forum importers:

  • AEF, Drupal7, Example, FluxBB, Invision, Mingle, MyBB, phpBB, PHPFox, PunBB, SimplePress, vBulletin v4.x, vBulletin v3.x, Xenforo and XMB forum importers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/admin/converters/phpBB.php

    r5150 r5170  
    194194        );
    195195
     196        // Topic Author ip (Stored in postmeta)
     197        $this->field_map[] = array(
     198            'from_tablename'  => 'posts',
     199            'from_fieldname'  => 'poster_ip',
     200            'join_tablename'  => 'topics',
     201            'join_type'       => 'INNER',
     202            'join_expression' => 'USING (topic_id) WHERE posts.post_id = topics.topic_first_post_id',
     203            'to_type'         => 'topic',
     204            'to_fieldname'    => '_bbp_author_ip'
     205        );
     206
    196207        // Topic content.
    197         // Note: We join the 'posts' table because 'topics' do not have content.
     208        // Note: We join the 'posts' table because 'topics' does not include topic content.
    198209        $this->field_map[] = array(
    199210            'from_tablename'  => 'posts',
     
    224235        );
    225236
     237        // Topic status (Open or Closed)
     238        $this->field_map[] = array(
     239            'from_tablename'  => 'topics',
     240            'from_fieldname'  => 'topic_status',
     241            'to_type'         => 'topic',
     242            'to_fieldname'    => 'post_status',
     243            'callback_method' => 'callback_topic_status'
     244        );
     245
    226246        // Topic parent forum id (If no parent, then 0)
    227247        $this->field_map[] = array(
     
    231251            'to_fieldname'    => 'post_parent',
    232252            'callback_method' => 'callback_forumid'
     253        );
     254
     255        // Sticky status (Stored in postmeta))
     256        $this->field_map[] = array(
     257            'from_tablename'  => 'topics',
     258            'from_fieldname'  => 'topic_type',
     259            'to_type'         => 'topic',
     260            'to_fieldname'    => '_bbp_old_sticky_status',
     261            'callback_method' => 'callback_sticky_status'
    233262        );
    234263
     
    268297            'to_fieldname'   => '_bbp_last_active_time',
    269298            'callback_method' => 'callback_datetime'
    270         );
    271 
    272         // Topic status (Open or Closed)
    273         $this->field_map[] = array(
    274             'from_tablename'  => 'topics',
    275             'from_fieldname'  => 'topic_status',
    276             'to_type'         => 'topic',
    277             'to_fieldname'    => 'post_status',
    278             'callback_method' => 'callback_topic_status'
    279         );
    280 
    281         // Topic Author ip (Stored in postmeta)
    282         $this->field_map[] = array(
    283             'from_tablename'  => 'posts',
    284             'from_fieldname'  => 'poster_ip',
    285             'join_tablename'  => 'topics',
    286             'join_type'       => 'INNER',
    287             'join_expression' => 'USING (topic_id) WHERE posts.post_id = topics.topic_first_post_id',
    288             'to_type'         => 'topic',
    289             'to_fieldname'    => '_bbp_author_ip'
    290299        );
    291300
     
    760769
    761770    /**
     771     * Translate the topic sticky status type from phpBB 3.x numeric's to WordPress's strings.
     772     *
     773     * @param int $status phpBB 3.x numeric forum type
     774     * @return string WordPress safe
     775     */
     776    public function callback_sticky_status( $status = 0 ) {
     777        switch ( $status ) {
     778            case 3 :
     779                $status = 'super-sticky'; // phpBB Global Sticky 'topic_type = 3'
     780                break;
     781
     782            case 2 :
     783                $status = 'super-sticky'; // phpBB Announcement Sticky 'topic_type = 2'
     784                break;
     785
     786            case 1 :
     787                $status = 'sticky';       // phpBB Sticky 'topic_type = 1'
     788                break;
     789
     790            case 0  :
     791            default :
     792                $status = 'normal';       // phpBB normal topic 'topic_type = 0'
     793                break;
     794        }
     795        return $status;
     796    }
     797
     798    /**
    762799     * Verify the topic reply count.
    763800     *
Note: See TracChangeset for help on using the changeset viewer.