• Resolved Lafare

    (@lafare)


    Hello,

    I’ve been using that plugin for a while and it proves to be very useful and reliable.

    I’ve remarked a problem occuring on fields like first_name, last_name,… If their value contains a special character like “&” it is expanded by WP to & (during the process of updating first_name meta – using filter : pre_user_first_name).

    When the field is exported back by the WP-MEMBERS it contains the expanded entity rather than the original value.

    If you could uses html_entity_decode when getting those meta, it would lead to a cleaner exported file.

    I’ve patched your code – user_export.php line 103 (v.3.1.6.3) like below:

    $data .= '"' . html_entity_decode(get_user_meta( $user, $meta, true )) . '",';

    It seems to make the job – I let you check and decide if it could be added in a next version.

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    That’s a possibility. I’ll need to evaluate it before saying for sure. My primary concern would if unsafe data were escaped when going into the user data, this could be a potential problem bringing it out. However, since it is being streamed as a CSV, that may not necessarily be exploitable.

    Thread Starter Lafare

    (@lafare)

    I understand your concern, you have no mean to know if the espaced data come from the original value of the field or were created by wordpress. May be a config option could let the plugin user decide which behaviour he wishes.

    • This reply was modified 8 years, 2 months ago by Lafare.
    Plugin Author Chad Butler

    (@cbutlerjr)

    I like the idea and I want to work it in. It will probably start as a filterable option.

    There is a $defaults array in the beginning of the function that has some elements that allow customizing the processing – file name, fields, excluded fields. To start out with, it will likely be added to that group.

    My initial go with this would be to add “entity_decode” as part of that array. This would be a true|false boolean. Starting out, it will default to false.

    Switching it on could be done as follows:

    add_filter( 'wpmem_export_args', function($args) {
        $args['entity_decode'] = true;
        return $args;
    });

    The file with proposed changes is available as a gist for testing here:
    https://gist.github.com/butlerblog/59ae104ed63d84821ec2f4b0bdcbba43

    Please give it a test run. I’ve scheduled this for adding to the 3.1.7 release that is in development.

    Thread Starter Lafare

    (@lafare)

    I had a try to it, it works as expected in my case.
    Thank you for the patch.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Improve export users’ is closed to new replies.