Skip to content

Serialized array's should be correctly displayed in the CSV #15

@fw25

Description

@fw25

Serialized array's are not converted to usable data in the result CSV

This is easily realized by changing user-export-with-their-meta-data/includes/class-wp-users.php

Add after line 102

public static function is_serial($string) {
    return (@unserialize($string) !== false);
}

On line 99, replace

$user_rows[ $record->user_id ][ $record->meta_key ] = $record->meta_value;

with

if ($this->is_serial($record->meta_value)) {
  $temp="";
  $space="";
  foreach (unserialize($record->meta_value) as $tempArray) {
    if (is_array($tempArray)) {
      $temp.=$record->meta_value.$space;
    } else {
      $temp.=$tempArray.$space;
    }
  }
  $user_rows[ $record->user_id ][ $record->meta_key ]=$temp;
} else {
  $user_rows[ $record->user_id ][ $record->meta_key ]=$record->meta_value;
}

Only the first level values of the array's are being converted. All the other levels remain untouched

With kind regards,

Felix Wagemakers

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions