Skip to:
Content

bbPress.org

Changeset 5541


Ignore:
Timestamp:
09/30/2014 11:20:15 PM (10 years ago)
Author:
netweb
Message:

Include anonymous topic and reply import support in Drupal7.php importer
Props netweb. See #2347

File:
1 edited

Legend:

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

    r5540 r5541  
    166166        );
    167167
     168        // Topic author name (Stored in postmeta as _bbp_anonymous_name)
     169        $this->field_map[] = array(
     170            'to_type'      => 'topic',
     171            'to_fieldname' => '_bbp_old_topic_author_name_id',
     172            'default'      => 'Anonymous'
     173        );
     174
     175        // Is the topic anonymous (Stored in postmeta)
     176        $this->field_map[] = array(
     177            'from_tablename'  => 'node',
     178            'from_fieldname'  => 'uid',
     179            'join_tablename'  => 'forum_index',
     180            'join_type'       => 'INNER',
     181            'join_expression' => 'ON node.nid = forum_index.nid',
     182            'to_type'         => 'topic',
     183            'to_fieldname'    => '_bbp_old_is_topic_anonymous_id',
     184            'callback_method' => 'callback_check_anonymous'
     185        );
     186
    168187        // Topic content.
    169188        // Note: We join the 'field_data_body' table because 'node' or 'forum_index' table does not include topic content.
     
    388407            'to_fieldname'    => 'post_status',
    389408            'callback_method' => 'callback_status'
     409        );
     410
     411        // Reply author name (Stored in postmeta as _bbp_anonymous_name)
     412        $this->field_map[] = array(
     413            'to_type'      => 'reply',
     414            'to_fieldname' => '_bbp_old_reply_author_name_id',
     415            'default'      => 'Anonymous'
     416        );
     417
     418        // Is the reply anonymous  (Stored in postmeta)
     419        $this->field_map[] = array(
     420            'from_tablename'  => 'comment',
     421            'from_fieldname'  => 'uid',
     422            'to_type'         => 'reply',
     423            'to_fieldname'    => '_bbp_old_is_reply_anonymous_id',
     424            'callback_method' => 'callback_check_anonymous'
    390425        );
    391426
     
    622657        return $count;
    623658    }
     659
     660    /**
     661     * Check the anonymous topic or reply status
     662     *
     663     * @since  (r5539)
     664     *
     665     * @param int $status Drupal v7.x anonymous topic/reply status
     666     * @return string WordPress safe
     667     */
     668    public function callback_check_anonymous( $status = 0 ) {
     669        if ( $status == 0 ) {
     670            $status = 'true';
     671        } else {
     672            $status = 'false';
     673        }
     674        return $status;
     675    }
    624676}
Note: See TracChangeset for help on using the changeset viewer.