• Resolved burton-nerd

    (@burton-nerd)


    After this on line 125:
    do_action('pre_acui_import_single_user', $headers, $data );
    Please add a filter like:
    $data = apply_filters('pre_acui_import_single_user_data', $data, $headers);

    This allows code to modify the imported field. For example, I want to turn comma-separated fields into an array. It’s easy with this filter:

    function fixSpecialties($data, $headers) {
        $key = array_search('specialties', $headers);
        if ($key !== false) {
            $specialties = explode(',',$data[$key]);
            $data[$key] = array_filter(array_map('trim', $specialties));
        }
        return $data;
    }
    add_filter('pre_acui_import_single_user_data', 'fixSpecialties', 10, 2);

    Thanks.

    https://ww.wp.xz.cn/plugins/import-users-from-csv-with-meta/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Please add this filter’ is closed to new replies.