Using Filters to Add Data Columns
-
I really like your plugin. Thank you for all your work!
I was attempting to use WP filters to add/change columns in the imported data (for example to create a username from first_name and last_name) but the number of columns is already calculated by the time the filter is called. It’s not a big problem, but could be useful.
There is a simple fix, that should not change anything else. Adding a filter for the “header” data (so the header columns can be changed) and moving the apply_filters() call for the other rows up before the number of columns check (so the column count in both still match) would do it.
So, in v1.11.3.7 , the existing line 120 onwards becomes:
if($row == 0): $data = apply_filters('pre_acui_import_header', $data); // check min columns username - email if(count( $data ) < 2){And existing line 157 becomes:
else: $data = apply_filters('pre_acui_import_single_user_data', $data, $headers); if( count( $data ) != $columns ): // if number of columns is not the same that columns in headerIs this something that you would consider adding?
Thanks Again
The topic ‘Using Filters to Add Data Columns’ is closed to new replies.