Require event submission field for specific access level/group only?

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 months 3 days ago #158331 by LMKweb
Is it possible to have a field on the frontend simple event submission form that is required only for a specific access level/usergroup? The use case is that people purchase a subscription using Membership Pro, then can add events in Events Booking using the simple frontend submission form. The lowest subscription level is required to use the "custom URL registration handle" field because we will not allow them to accept event registrations through the site. I'd like to make that field required for that access level or usergroup only, so that it's optional for the higher level subscribers. 

Thank you!

Please Log in or Create an account to join the conversation.

More
11 months 3 days ago #158333 by Tuan Pham Ngoc
Hi

Unfortunately, it is not supported. We could not allow you to control every single field on submit event form base on user access level. So you will need to customize code of the extension if you want to have it works like that

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 months 2 days ago #158348 by LMKweb
OK thank you! In that case, is it possible to require a field for everyone on the event submission form? I didn't see a way to turn that on.

Please Log in or Create an account to join the conversation.

More
11 months 2 days ago #158350 by Tuan Pham Ngoc
There are many fields on submit event form, so it is hard/impossible for the system to allow you to configure which field to be required/optional. So you will need some coding knowledge to customize the code. In your specific case, you can use this code:
Code:
if ($this->config->get('fes_show_custom_registration_handle_url', 1)) { if (in_array(2, Factory::getUser()->getAuthorisedViewLevels())) { $requiredValidation = ' validate[required]'; } else { $requiredValidation = ''; } ?> <div class="<?php echo $controlGroupClass; ?>"> <div class="<?php echo $controlLabelClass; ?>"> <?php echo EventbookingHelperHtml::getFieldLabel('registration_handle_url', Text::_('EB_CUSTOM_REGISTRATION_HANDLE_URL'), Text::_('EB_CUSTOM_REGISTRATION_HANDLE_URL_EXPLAIN')); ?> </div> <div class="<?php echo $controlsClass; ?>"> <input type="url" name="registration_handle_url" id="registration_handle_url" class="input-xxlarge form-control<?php echo $requiredValidation; ?>" size="10" value="<?php echo $this->item->registration_handle_url; ?>" /> </div> </div> <?php }

Replace 2 with ID of the access level which you want to make the field required. That should work.

Tuan
The following user(s) said Thank You: LMKweb

Please Log in or Create an account to join the conversation.

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 months 11 hours ago #158381 by LMKweb
Thanks Tuan! We've actually decided to require it for everyone, though I'm going to save this code for future use in case that changes. How would I modify that code to require it for everyone?

Please Log in or Create an account to join the conversation.

More
11 months 56 minutes ago #158388 by Tuan Pham Ngoc
You can use the following code:
Code:
if ($this->config->get('fes_show_custom_registration_handle_url', 1)) { ?>     <div class="<?php echo $controlGroupClass;  ?>">         <div class="<?php echo $controlLabelClass; ?>">             <?php echo EventbookingHelperHtml::getFieldLabel('registration_handle_url', Text::_('EB_CUSTOM_REGISTRATION_HANDLE_URL'), Text::_('EB_CUSTOM_REGISTRATION_HANDLE_URL_EXPLAIN')); ?>         </div>         <div class="<?php echo $controlsClass; ?>">             <input type="url" name="registration_handle_url" id="registration_handle_url"                    class="input-xxlarge form-control validate[required]" size="10" value="<?php echo $this->item->registration_handle_url; ?>" />         </div>     </div> <?php }

I'm sorry to say but you would need to have a developer to help you if you want to customize the code. I could not always be available to provide code support for your change requests like this. I would expect that you know basic PHP/Joomla programming so that with the code I sent you earlier, you could adapt it to meet your need.

Regards,

Tuan

Please Log in or Create an account to join the conversation.