Skip to:
Content

bbPress.org

Changeset 5539


Ignore:
Timestamp:
09/25/2014 07:05:49 AM (10 years ago)
Author:
netweb
Message:

Include anonymous topic and reply import support in phpBB.php and SMF.php importers
Props netweb. See #2347

Location:
trunk/src/includes/admin/converters
Files:
2 edited

Legend:

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

    r5530 r5539  
    190190        );
    191191
     192        // Topic author name (Stored in postmeta as _bbp_anonymous_name)
     193        $this->field_map[] = array(
     194            'from_tablename'  => 'messages',
     195            'from_fieldname'  => 'poster_name',
     196            'join_tablename'  => 'topics',
     197            'join_type'       => 'LEFT',
     198            'join_expression' => 'ON topics.id_first_msg = messages.id_msg',
     199            'to_type'         => 'topic',
     200            'to_fieldname'    => '_bbp_old_topic_author_name_id'
     201        );
     202
     203        // Is the topic anonymous (Stored in postmeta)
     204        $this->field_map[] = array(
     205            'from_tablename'  => 'topics',
     206            'from_fieldname'  => 'id_member_started',
     207            'to_type'         => 'topic',
     208            'to_fieldname'    => '_bbp_old_is_topic_anonymous_id',
     209            'callback_method' => 'callback_check_anonymous'
     210        );
     211
    192212        // Topic Author ip (Stored in postmeta)
    193213        $this->field_map[] = array(
     
    368388            'to_fieldname'    => 'post_author',
    369389            'callback_method' => 'callback_userid'
     390        );
     391
     392        // Reply author name (Stored in postmeta as _bbp_anonymous_name)
     393        $this->field_map[] = array(
     394            'from_tablename'  => 'messages',
     395            'from_fieldname'  => 'poster_name',
     396            'to_type'         => 'reply',
     397            'to_fieldname'    => '_bbp_old_reply_author_name_id'
     398        );
     399
     400        // Is the reply anonymous (Stored in postmeta)
     401        $this->field_map[] = array(
     402            'from_tablename'  => 'messages',
     403            'from_fieldname'  => 'id_member',
     404            'to_type'         => 'reply',
     405            'to_fieldname'    => '_bbp_old_is_reply_anonymous_id',
     406            'callback_method' => 'callback_check_anonymous'
    370407        );
    371408
     
    641678        $count = absint( (int) $count - 1 );
    642679        return $count;
     680    }
     681
     682    /**
     683     * Check the anonymous topic or reply status
     684     *
     685     * @since  (r5539)
     686     *
     687     * @param int $status SMF v2.x anonymous topic/reply status
     688     * @return string WordPress safe
     689     */
     690    public function callback_check_anonymous( $status = 0 ) {
     691        if ( $status == 0 ) {
     692            $status = 'true';
     693        } else {
     694            $status = 'false';
     695        }
     696        return $status;
    643697    }
    644698
  • trunk/src/includes/admin/converters/phpBB.php

    r5530 r5539  
    194194        );
    195195
     196        // Topic author name (Stored in postmeta as _bbp_anonymous_name)
     197        $this->field_map[] = array(
     198            'from_tablename'  => 'topics',
     199            'from_fieldname'  => 'topic_first_poster_name',
     200            'to_type'         => 'topic',
     201            'to_fieldname'    => '_bbp_old_topic_author_name_id'
     202        );
     203
     204        // Is the topic anonymous (Stored in postmeta)
     205        $this->field_map[] = array(
     206            'from_tablename'  => 'topics',
     207            'from_fieldname'  => 'topic_poster',
     208            'to_type'         => 'topic',
     209            'to_fieldname'    => '_bbp_old_is_topic_anonymous_id',
     210            'callback_method' => 'callback_check_anonymous'
     211        );
     212
    196213        // Topic Author ip (Stored in postmeta)
    197214        $this->field_map[] = array(
     
    358375            'to_fieldname'    => 'post_author',
    359376            'callback_method' => 'callback_userid'
     377        );
     378
     379        // Reply author name (Stored in postmeta as _bbp_anonymous_name)
     380        $this->field_map[] = array(
     381            'from_tablename'  => 'posts',
     382            'from_fieldname'  => 'post_username',
     383            'to_type'         => 'reply',
     384            'to_fieldname'    => '_bbp_old_reply_author_name_id'
     385        );
     386
     387        // Is the reply anonymous (Stored in postmeta)
     388        $this->field_map[] = array(
     389            'from_tablename'  => 'posts',
     390            'from_fieldname'  => 'poster_id',
     391            'to_type'         => 'reply',
     392            'to_fieldname'    => '_bbp_old_is_reply_anonymous_id',
     393            'callback_method' => 'callback_check_anonymous'
    360394        );
    361395
     
    792826
    793827    /**
     828     * Check the anonymous topic or reply status
     829     *
     830     * @since  (r5539)
     831     *
     832     * @param int $status phpBB v3.x anonymous topic/reply status
     833     * @return string WordPress safe
     834     */
     835    public function callback_check_anonymous( $status = 0 ) {
     836        if ( $status == 1 ) {
     837            $status = 'true';
     838        } else {
     839            $status = 'false';
     840        }
     841        return $status;
     842    }
     843
     844    /**
    794845     * This callback processes any custom parser.php attributes and custom code with preg_replace
    795846     */
Note: See TracChangeset for help on using the changeset viewer.