1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed SMF Importer Beta Improvements

Discussion in 'Resolved Bug Reports' started by Chris D, Nov 20, 2014.

  1. Chris D

    Chris D XenForo Developer Staff Member

    Some improvements have been made to the SMF Importer.
    • Avatars and attachments now import correctly in the event that there is only one configured attachments directory.
    • A member's date of birth is only imported if it is valid.
    •   has been cleaned up from post content.
    Currently these issues are fixed in XenForo 1.4.4 but if you would like to beta test the updated importer it is attached below.

    The updated file can overwrite the exiting file at the following path:

    library/XenForo/Importer/SMF.php

     

    Attached Files:

    • SMF.php
      File size:
      53 KB
      Views:
      51
    Maurands and leemy like this.
  2. Maurands

    Maurands Member

    Hi chris, any idea when xenforo 1.4.4 will be released?
     
  3. Chris D

    Chris D XenForo Developer Staff Member

    It very much depends on a few factors but with regards to the SMF importer it's not particularly relevant:

     
  4. Maurands

    Maurands Member

    no problem, I will raise a ticket for the fixed file in the customer area, thanks chris
     
    Chris D likes this.
  5. Chris D

    Chris D XenForo Developer Staff Member

    The first post of this thread now contains an updated version of the importer.
     
  6. Some fixes:

    SMF.php

    Missing gender and custom title:
    Replace:
    PHP:
                'user_state' => ($user['is_activated'] == 1) ? 'valid' 'moderated'
    With:
    PHP:
                'user_state' => ($user['is_activated'] == 1) ? 'valid' 'moderated',
                
    'gender' => ($user['gender'] == 1) ? 'male' : (($user['gender'] == 2) ? 'female' ''),
                
    'custom_title' => $user['personal_text'],
    In my case, birthdate was yyyy/mm/dd.
    Replace:
    PHP:
            if ($user['birthdate'])
            {
                
    $parts explode('-'$user['birthdate']);
                if (
    count($parts) == 3)
                {
                    
    // Default birth year.
                    
    if (trim($parts[2]) != '0001')
                    {
                        
    $import['dob_day'] = trim($parts[0]);
                        
    $import['dob_month'] = trim($parts[1]);
                        
    $import['dob_year'] = trim($parts[2]);
                    }
                }
            }
    with:
    PHP:
            if ($user['birthdate'] && $user['birthdate'] != '0001-01-01')
            {
                
    $parts explode('-'$user['birthdate']);
                if (
    count($parts) == 3)
                {
                    
    $import['dob_year'] = trim($parts[0]);
                    
    $import['dob_month'] = trim($parts[1]);
                    
    $import['dob_day'] = trim($parts[2]);
                }
            }
    Abstract.php

    In my case, since i'm not sure only   is there i wanted to play sure (today's fix version already handles nbsp in SMF.php)

    After:
    PHP:
         $string utf8_unhtml($string$entities);
         
    $string preg_replace('/[\xF0-\xF7].../'''$string);
         
    $string preg_replace('/[\xF8-\xFB]..../'''$string);
    Add:
    PHP:
         $string html_entity_decode($stringENT_QUOTES'UTF-8');
     
    Last edited: Dec 4, 2014

Share This Page