0

Is there a way (with hook or plugin) to limit media upload to once a day per user? I can only find related articles about limit file size.

Edit: The reason I want to use this is I'm setting up a social site where people share images. I'm seeing an increase in data usage and would like to have a bit control in the setup fase.

I'm now controlling image file size (set to max 1MB per file) and a quota per user profile for 50MB. But it would be perfect to set max upload on 1 per day.

  • 1
    Why would you do this? – s_ha_dum Nov 20 '15 at 14:08
  • 1
    Please not that plugin recommendations are off topic. – birgire Nov 20 '15 at 14:08
1

You will need to create a meta field for users identifying that user when he already uploaded something in that day (or in the last 24 hours).

After you do that, you will need to create a function to trigger in some upload action, like wp_handle_upload_prefilter or wp_handle_upload to check if user can upload something today, returning a error if not.

It can be done, but it will not be simple as putting a single function on your theme.

  • You mean something like after upload add a meta field value like uploadedFriday and check with new upload if uploadedFriday = uploadedFriday, sorry you can't upload more media today. In that direction? And a function to update the meta field value and a function which catches the upload handle to check if uploading is approved? – AKNL Nov 20 '15 at 18:29
  • I have found a plugin which matches my wishes and is much faster than developing this for my own. Thanks Bruno for your thoughts! – AKNL Nov 20 '15 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.