Hi. I am just starting to work on a similar use case.
I think you would not want to edit the plugin files directly as your customizations would be overwritten during an upgrade. That being said, you can find info on filters and actions (that you would use in your functions.php file) here: http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/ (Scroll down to “filters/actions”).
If you have not already found how to add custom fields look here: http://www.iptanus.com/the-new-form-fields-of-wordpress-file-upload-plugin/
Those are my next/first steps.
Good luck and let us know what you find.
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 {
}
Just noticed that there is a mistake in line four; right would be
'post_content' => '<div class ="XY">' . $content . '</div>',
Hi,
sorry for my delayed response, do you still have the problem?
Nickolas