Skip to:
Content

bbPress.org


Ignore:
Timestamp:
10/10/2014 06:44:33 AM (11 years ago)
Author:
netweb
Message:

Move callback callback_check_anonymous from individual importers to BBP_Converter_Base in converter.php.

  • Allows us to lean on callback_userid to determine multiple anonymous or guest topic and reply authors during import and reduces code duplication

Props netweb. See #2347

File:
1 edited

Legend:

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

    r5542 r5544  
    576576        $count = absint( (int) $count - 1 );
    577577        return $count;
    578     }
    579 
    580     /**
    581      * Check the anonymous topic or reply status.
    582      *
    583      * This method checks each imported topic or reply if the author user ID
    584      * was imported to determine if the topic or reply author is anonymous as
    585      * Vanilla v2.x does not store a topic or reply status for deleted users.
    586      *
    587      * @since  (r5541)
    588      *
    589      * @param string $is_user_anonymous Vanilla v2.x numeric topic status
    590      * @return string WordPress safe
    591      */
    592     public function callback_check_anonymous( $is_user_anonymous = 0 ) {
    593         if ( !empty( $this->sync_table ) ) {
    594             $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_user_id" AND meta_value = "%d" LIMIT 1', $is_user_anonymous ) );
    595         } else {
    596             $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT meta_value FROM ' . $this->wpdb->usermeta .  ' WHERE meta_key = "_bbp_old_user_id" AND meta_value = "%d" LIMIT 1', $is_user_anonymous ) );
    597         }
    598 
    599         // An imported user ID exists therefore the topic/reply is not anonymous
    600         if ( !is_null( $row ) ) {
    601             $is_user_anonymous = 'false';
    602         // No imported user ID there the topic/reply is anonymous
    603         } else {
    604             $is_user_anonymous = 'true';
    605         }
    606 
    607         return $is_user_anonymous;
    608578    }
    609579
Note: See TracChangeset for help on using the changeset viewer.