Hello,
First, amazing plugin(s)... i've been developing with it for years and its great to see all the new features and functionality.
I have an interesting situation where logged in users (subscriber) can upload a file using the Frontend Submission extension. I would like those files to be stored in a folder with the id of the post (for archive / backup / organization). The code below works great if you're using the WP dashboard, but if you upload using the Frontend, it just uploads to the "/uploads/application_files/" folder ... eg it does not append the post_id.
Thoughts about what I might be doing wrong? The code below is based on an earlier support suggestion in the forums.
thanks 🙂
matt
Snippet of code inside my add_filter( 'rwmb_meta_boxes', '...' )
$post_id = null;
if ( isset( $_GET['post'] ) ) {
$post_id = intval( $_GET['post'] );
} elseif ( isset( $_POST['post_ID'] ) ) {
$post_id = intval( $_POST['post_ID'] );
} elseif ( isset( $_GET['rwmb_frontend_field_post_id'] ) ) { // Added
$post_id = intval( $_GET['rwmb_frontend_field_post_id'] ); // Added
}
...
...
[
'name' => 'File',
'id' => $prefix.'adjustment_file',
'type' => 'file',
'max_file_uploads' => 1,
'upload_dir' => WP_CONTENT_DIR . '/uploads/application_files/' . $post_id . '/',
],