Hi davedi,
indeed I did change the plugin files directly because I couldn’t find another way to get to the field data. So I have to include the code again everytime I update WP File Upload… not perfect but manageable.
So what I did was changing wp-file-upload/lib/wfu_processfiles.php; right after the place when the final filename for the uploaded file is set (so right after the place in the code where it is defined what happens when a file with the same filename already exists, about line 425 or so), I put in the code lines below.
The variable which contains the submitted user fields data is called $userdata_fields. What I basically do is using the user field data to create a post with these values. One user field defines the post’s category, another the post’s tags, another the post’s title. The posts content is created by extracting the text of uploaded pdf files by means of the ‘pdftotext’ utility ($content in my example, not shown in the code below, https://en.wikipedia.org/wiki/Pdftotext).
$post_creation_date = current_time( mysql, 0 );
$category_ID = get_cat_ID( $userdata_fields[1]['value'] );
$post = array(
'post_content' => '<div class ="XY">' . $content . '</div>,
'post_title' => htmlspecialchars( $userdata_fields[0]['value'] ),
'post_status' => 'publish',
'post_type' => 'post',
'post_author' => 4,
'post_date' => $post_creation_date,
'post_category' => [$category_ID],
'tags_input' => htmlspecialchars( $userdata_fields[3]['value'])
);
wp_insert_post( $post );
}
else {
}