Hi Neiji,
Welcome to BuddyDev forums.
Thank you for using MediaPress.To disable the multiple file selection, you can put the following line in your bp-custom.php
add_filter( 'mpp_upload_default_settings', 'mpp_allow_single_file_selection_only'); function mpp_allow_single_file_selection_only( $settings ) { $settings['multi_selection'] = false; return $settings; }
That will limit the selection of one at a time but will not stop users from selecting multiple files. Now, since we don’t want users to upload more than one file at a time, we will take a little help from javascript.
Please put this js in your theme’s js file
jQuery( document ).ready( function () { if( _mppData == undefined ) { return ; } mpp.guploader.isRestricted = check_file_limit; mpp.activity_uploader.isRestricted = check_file_limit; function check_file_limit( uploader, file ) { //clear any error we had earlier jQuery('#message').remove(); var size = uploader.files.length; //allow selecting/uploading if( size <=1 ) { return false;//no restriction } //remove file from queue uploader.removeFile( file ); uploader.refresh(); //remove the feedback that we added this.removeFileFeedback( file ); //notify error message mpp.notify( "Only one file can be uploaded at a time", 1 ); return true; //yes, this should be restricted } });
That’s all you will need to do. Please try it and let me know if that works for you or not?
Thank you
Brajesh
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
This topic is: not resolved