Title: Max Image upload for different users
Last modified: April 1, 2019

---

# Max Image upload for different users

 *  Resolved [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/)
 * In the Image Expansion Kit I can specify the maximum number of files that a user
   can upload. I have a few levels of membership on my site and I would like to 
   have say 3 files max upload for a Standard Membership and 10 files max upload
   for a Premier Membership.
 * Is this possible?
 * Thanks

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11380585)
 * There is a filter
 * pdb-{$fieldname}_maxfiles
 * that you can use to set the maximum number of uploads at runtime…in other words,
   if someone is logged in, you can use that filter to change the number of allowed
   uploads.
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11381054)
 * I can’t see how to use this filter Roland. I’ve used it in my shortcode but with
   no effect. I’ve also created a field in my database called ‘maximum_files’.
 * <?php
 * $maximum_files=’7′;
 * echo do_shortcode(‘[pdb_record filter=pdb-{$maximum_files}_maxfiles fields=”photo_library”
   record_id=’.$user_id.’]’);
 * Thanks
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11381438)
 * Sorry, not a shortcode filter, this is a filter you will need to write a handler
   for. It passes in the global setting, your handler need to return the limit you
   want to set at that time.
 * for example, if the field name is “photo_gallery” then your filter will be:
 * pdb-photo_gallery_maxfiles
 * General info on using WordPress filters: [apply_filters](https://developer.wordpress.org/reference/functions/apply_filters/)
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11383807)
 * I have a field called ‘photo_library’ which is defined as a ‘Multi Image Upload’.
   
   I have set my default value of maximum files to upload as 5.
 * This is my function, but it doesn’t work. It won’t let me upload more than 5 
   files.
 *     ```
       // filter hook - pdb-photo_library_maxfiles
       function change_max_files($files) {
           $files=='7';
           return $files;
       }
       add_filter('pdb-photo_library_maxfiles','change_max_files');
       ```
   
 * Many thanks
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11385656)
 * You need to use a single = to assign the value, you have 2.
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11386816)
 * Changed that to a single = sign but still doesn’t work.
 *     ```
       function change_max_files($files) {
           $files='7';
           return $files;
       }
       add_filter('pdb-photo_library_maxfiles','change_max_files');
       ```
   
 *  Plugin Author [xnau webdesign](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11388903)
 * OK, I’m sorry, I got it wrong…the filter is supposed to use the name of the form
   element, not the name of the field. So the filter should be:
 * pdb-multi-image-upload_maxfiles
 * so like this:
 *     ```
       function change_max_files($files) {
           $files='7';
           return $files;
       }
       add_filter('pdb-multi-image-upload_maxfiles','change_max_files');
       ```
   
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11388938)
 * Wonderful, works a treat. I can now set different file upload levels for users.
 * Many Thanks
 *  Thread Starter [supernova42](https://wordpress.org/support/users/supernova42/)
 * (@supernova42)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11388939)
 * Meant to close it

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Max Image upload for different users’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [supernova42](https://wordpress.org/support/users/supernova42/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/max-image-upload-for-different-users/#post-11388939)
 * Status: resolved