limit # of users which can select a certain value

13 years 10 months ago #137086 by hunguitar
I would like to limit the number of users which are capable of selecting a certain value of a field in their profile.
I'm using it for workshop sign-up.

Could you recommend a simple way to do this?

I was thinking about getting an sql query result when pressing the update button on the profile, and depending on the # of users already having that value for that field it would give a message and go back to the profile edit page or continue to update that field.

I just dont find where I would have to input this (i cant find the function called when pressing the update button)

Any suggestions?
Or would there be a simpler solution?

thanks very very much

Please Log in to join the conversation.

13 years 10 months ago #137190 by krileon
Best approach is to create a new fieldtype plugin which takes the existing count into consideration when building the drop-down list. For examples of how to make such a plugin please review the ajax text and file fiedltype plugins. You can also review cb.core.php which stores all of CBs fieldtypes to assist in creating a new plugin. The easiest approach is to perform a query and change the fields value on the trigger onBeforeUserUpdate in a new CB plugin (please see tutorials within signature for further trigger usage information).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.246 seconds

Facebook Twitter LinkedIn