I am using this hook to change the file upload folder:
add_filter( 'frm_upload_folder', 'frm_custom_upload', 10, 2 );
function frm_custom_upload( $folder, $atts ) {
if ( $atts['form_id'] == 2 ) { // change to your form id
global $current_user;
$folder = '/ms/' . $current_user->wpc_cf_client_file_cat;
}
return $folder;
}
Now, I want to keep this folder for other forms as well. For example, for both Form ID 2 and 35. How can I do this?
Maybe put the form ids into an array and loop through using the dynamic value. Something like this:
add_filter( 'frm_upload_folder', 'frm_custom_upload', 10, 2 );
function frm_custom_upload( $folder, $atts ) {
$formids = [2,35];
foreach ($formids as $val) {
if ( $atts['form_id'] == $val ) {
global $current_user;
$folder = '/ms/' . $current_user->wpc_cf_client_file_cat;
}
return $folder;
}
}
Thanks a lot.
Please login or Register to submit your answer