Skip to content

Instantly share code, notes, and snippets.

View 89gsc's full-sized avatar

... 89gsc

View GitHub Profile
@89gsc
89gsc / functions.php
Created September 1, 2020 16:13
This will set the hook for woocommerce for mailchimp plugin to output on a different hook than the default.
// Replace YOUR_NEW_HOOK_NAME with the correct hook you want to output at, this should be within the form on the checkout still...
// I just needed to move mine from the addresss to somewhere else on the checkout.
$mailchimp_options = get_option('mailchimp-woocommerce');
if($mailchimp_options && isset($mailchimp_options['mailchimp_checkbox_action'])) {
$mailchimp_options['mailchimp_checkbox_action'] = 'YOUR_NEW_HOOK_NAME';
update_option('mailchimp-woocommerce', $mailchimp_options);
}
@89gsc
89gsc / filter-example.php
Last active March 15, 2022 15:15
Gravity Forms - Set a radio selected button via PHP
add_filter('gform_pre_render', function($form)
{
$user_consent_form = get_field('user_contact_preferences_form', 'option');
if ($user_consent_form) {
if ($form['id'] === (int)$user_consent_form) {
// This should return an array if its set.
$user_consent_marketing = get_user_meta(get_current_user_id(), 'marketing_consent');
if ($user_consent_marketing) {
// find out which field is "marketing_consent"
@89gsc
89gsc / filter.php
Created May 12, 2022 12:35
Formidable - edit success message, added method to add post ID as using global post object / wp_query all appear to fail. Attempted to validate post id from hidden input field.
<?php
add_filter('frm_success_filter', 'add_the_download_form_button', 1000, 2);
function add_the_download_form_button($type, $form)
{
// If this is the download form we can now check for a file.
if ($form->id == 4
&& isset($_POST)) {
$pid = null;