Skip Navigation

[Resolved] Impose Total Upload Limits per Access Role

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 6.91 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2330449

Tell us what you are trying to do? Have asked this before with no affirmation. Can Toolset allow developer to impose total upload limits per Access role or Role in general? For example: Role A 100MB, Role B 200MB... or upgrade for more upload storage.

Is there any documentation that you are following? No

Is there a similar example that we can see? This is a standard function of modern subscription/membership models. I cannot figure out how to achieve this with Toolset.

What is the link to your site? Provided in the form site selection. Is this information stricken in the post?

#2330583

Hi,

Thank you for contacting us and I'd be happy to assist.

This feature is not available out of the box, so implementing an upload limit like this will require a fair amount of customization.

For example, you can add two user custom fields "Total allowed uploads size" and "Total consumed uploads size".

You'll need to make sure that the users can upload the files only through Toolset Forms.

Using the "cred_form_validate" hook, you can include a custom validation function to check the size of the file being uploaded and allow the form submission only if the sum of the "Total consumed uploads size" field value and the currently uploaded file, doesn't exceed the value of the custom field "Total allowed uploads size":
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

And on successful form submission, you can use the custom function attached to the hook "cred_save_data" to add the new file's size, to the value of the current user's "Total consumed uploads size" field:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar