mutagennix
Forum Replies Created
-
Hey,
This is the code I use in my child theme’s functions.php file to remove the Google script from loading on unwanted pages:
//Remove Google ReCaptcha code/badge everywhere apart from select pages add_action('wp_print_scripts', function () { //Add pages you want to allow to array if ( !is_page( array( 'contact','some-other-page-with-form' ) ) ){ wp_dequeue_script( 'google-recaptcha' ); //wp_dequeue_script( 'google-invisible-recaptcha' ); } });
Hope this helps. Good luck.
Forum: Plugins
In reply to: [Contact Form 7] Price depend on dropdown selectionHey,
You may want to add conditional logic to your Contact Form 7 using this plugin:
https://www.ads-software.com/plugins/cf7-conditional-fields/
And here is a tutorial:
https://conditional-fields-cf7.bdwm.be/conditional-fields-for-contact-form-7-tutorial/
Hope it helps. Good luck.
Forum: Plugins
In reply to: [My Tickets - Accessible Event Ticketing] Custom fields cookie/user metaThank you so much for pointing me in the right direction.
This is the way I used it in “mt-fields-api.php” and it works great for my purpose.
function mt_handle_custom_field( $saved, $submit ) { $event_id = $submit['mt_event_id']; mt_delete_data('test_event_data1_' . $event_id); mt_delete_data('test_event_data2_' . $event_id); mt_delete_data('test_event_data3_' . $event_id);
Forum: Plugins
In reply to: [My Tickets - Accessible Event Ticketing] Custom fields cookie/user metaI think the tickets have the same issue as the custom fields checkbox/radio you mentioned, “When an individual checkbox that is un-checked is submitted, it doesn’t send an empty value; it sends nothing at all“. The checkbox/radio group update you mentioned would be great for a future release.
Since I only have a single event and wanted to only allow a single ticket type, adding mt_delete_cart() was the only way I could clear the cart first before changing/submitting my ticket option when “Add to cart” is pressed. Originally I had to delete individual tickets on the purchase/cart page that I didn’t want.
The mt_delete_cart() function I added to “function mt_ajax_handler()” deletes the tickets but does not delete/clear custom fields data.
In the mean time, is there a way for me to delete/clear all tickets and all custom fields data first, and then submit the selected tickets and custom field data when “Add to cart” is pressed?
- This reply was modified 7 years, 4 months ago by mutagennix.
Forum: Plugins
In reply to: [My Tickets - Accessible Event Ticketing] Custom fields cookie/user metaHello Joe,
Thank you for getting back to me.
Here is a link to my test website “https://printnetpartners.com.au/phsanz/phsanz-asm/”. The tickets and custom fields are at the bottom of the event page.
Quirk: For some reason all the custom field check boxes are ticked on first page load. When page is refreshed, the check boxes are not ticked.
Not sure if this section in “mt-fields.api.php” is the reason since checkboxes have “input_values”:
case "checkbox": case "radio": if ( isset( $field['input_values'] ) ) { $value = $field['input_values']; if ( $user_value != '' ) { $checked = ' checked="checked"'; } else { $checked = ''; } $output = "<input type='" . $field['input_type'] . "' name='$name' id='$name' value='" . esc_attr( stripslashes( $value ) ) . "'$checked />"; } break;
In “to mt_ajax.php”, I added the “mt_delete_data” function in front to clear the cart first since I only want one ticket to be available for purchase at a time:
function mt_ajax_handler() { mt_delete_data( 'cart' ); $options = array_merge( mt_default_settings(), get_option( 'mt_settings' ) );
If you select a ticket and session(s) and click “Register and Pay”, you should be redirected to purchase/cart page (jQuery used for redirect). Now if you go back to event page and change your selections, then click “Register and Pay”, you will notice that the ticket in cart changes correctly but session(s) don’t update correctly. I tried in different browsers with same result.
Are the custom fields saved to a separate cookie, if so then how do I clear cookie first and then update it when “Add to cart” or in my case “Register and Pay” button is pressed?
Thank you in advance for your assistance.
- This reply was modified 7 years, 4 months ago by mutagennix.
I have used JS/jQuery (within jquery.public.js) to mimic radio buttons for the time being. I just have the “checked” attribute added/removed. I am using WordPress 4.8 by the way.
There seems to be an issue with cart updating. When I select type ticket#1 then click “add to cart” button, then deselect ticket#1 and select type ticket#2 and click “add to cart” button, both are now added. It seems like any unselected tickets don’t get removed from cart via the ajax call but can only be added.
How can I force all unselected ticket types to be removed from the cart when “add to cart” button is pressed?