Show/hide event custom fields based on usergroup/access level on frontend submit

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 8 months ago #158052 by LMKweb
Is it possible to show or hide event custom fields on the front-end submit form depending on access level?

The scenario is that we are offering the ability to add events for specific users that have an active Memberships Pro subscription plan.

Subscription Plan A/Usergroup A gets all the fields + registration capabilities for event sign-ups
Subsciption Plan B/Usergroup B gets fewer fields + only custom registration URL box (no online registration for the event - so we want to hide the PayPal & notification email field)

I'm using the simple front-end submit form.

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

More
1 year 8 months ago #158054 by Tuan Pham Ngoc
Hello

This is, unfortunately, not supported and would require code modification. The file is components/com_eventbooking/themes/default/event/simple.php

Please note that once the modification is done, you should move the modified file to PATH_TO_TEMPLATE/html/com_eventbooking/event folder so that the change won't be lost when you update to future releases of the extension

Regards,

Tuan

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

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 8 months ago #158057 by LMKweb
Thanks - I've already customized the submission form some, so I've created the override and saved it. I'm just not sure if there's a particular code to get it to show for user groups or access levels?

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

More
1 year 8 months ago #158061 by Tuan Pham Ngoc
You can use code like in the attached zip file. Then for each event custom field, you can add a new attribute called submit_event_access to contain the access level which you want to allow seeing that field on form. For example;

<field name="field_speaker" type="text" label="Speaker" size="50" description="" submit_event_access="2"></field>            

This will only show the field for users who has Registered access level (ID = 2)

Please try that and let me know if it works

Tuan

 
Attachments:

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

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 8 months ago #158248 by LMKweb
Thank you! Unfortunately I couldn't get it to work. I tried both the ID# for the group and the access level, but the field continued to show regardless of what level I logged-in with.

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

More
1 year 8 months ago #158252 by Tuan Pham Ngoc
That's strange to me. Please submit a support ticket sending us :

1. Super admin account of the site

2. Link to submit event page

3. An account which can be used to access to that page and what fields should be shown/hidden

I will check to see what's wrong and get it corrected for you

Regards,

Tuan

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

  • LMKweb
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 8 months ago #158309 by LMKweb
I will do that! Quick clarification - does this only work on event custom fields? For example, two of the fields I'm trying to restrict access to are the PayPal email address and Notification email address fields. This is the code I have currently in the simple.php override:
Code:
        <?php         }         if ($this->config->get('fes_show_notification_emails', 1))         {         ?>             <div class="<?php echo $controlGroupClass;  ?>">                 <div class="<?php echo $controlLabelClass; ?>">                     <?php echo Text::_('EB_NOTIFICATION_EMAILS'); ?>                 </div>                 <div class="<?php echo $controlsClass; ?>">                     <input type="text" name="notification_emails" class="form-control" size="70" submit_event_access="13" value="<?php echo $this->item->notification_emails ; ?>" />                 </div>             </div>             <div class="<?php echo $controlGroupClass; ?> form-help">                 <div class="<?php echo $controlLabelClass; ?>"> </div>                                 <div class="<?php echo $controlsClass; ?>">Where do you want to be notified when someone registers for an event? Leave it blank to use your default account email address.</div>             </div>

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

More
1 year 8 months ago #158310 by Tuan Pham Ngoc
Hello

Yes. The feature which we implemented here only works for event custom fields.

With your above code, something like:
Code:
if ($this->config->get('fes_show_notification_emails', 1) && in_array(2, Factory::getUser()->getAuthorisedViewLevels())) { //Code to show field here }

2 in the above example is ID of the access level which you want to allow access to the field

Regards,

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
1 year 8 months ago #158330 by LMKweb
Thanks so much, that worked perfectly!

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

More
1 year 8 months ago #158335 by Tuan Pham Ngoc
Great. Thanks for confirming.

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