Both options can be done using the plugin’s filters. What do you prefer?
Regards
Nickolas
Hi Nickolas,
Thanks for the answer,
Well the best case scenario would be for the users to be able to upload file only once, and then on the upload field to have a text that they have already uploaded the file.
BR
Do you want the whole upload form to be replaced by a text?
Nickolas
Either text, or the button for upload to be disabled or something.
thanks
Ok here is the code:
global $WFU_MAX_FILES, $WFU_ERROR_MESSAGE;
$WFU_MAX_FILES = 1;
$WFU_ERROR_MESSAGE = "You are not allowed to upload any more files.";
if (!function_exists('wfu_file_upload_output_handler')) {
function wfu_file_upload_output_handler($output, $params) {
global $WFU_MAX_FILES, $WFU_ERROR_MESSAGE;
$user = wp_get_current_user();
if ( $user->ID > 0 ) {
$recs = wfu_get_recs_of_user($user->ID);
if ( count($recs) >= $WFU_MAX_FILES )
$output = $WFU_ERROR_MESSAGE;
}
return $output;
}
add_filter('_wfu_file_upload_output', 'wfu_file_upload_output_handler', 10, 2);
}
You need to put it at the end of functions.php file ofyour theme. When maximum number of uploaded files is exceeded (1 in your case), the upload form will be substituted by error message.
Regards
Nickolas
It works.
Thank you very much Nickolas