This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gform_entry_is_spam_6', 'filter_gform_email_is_blacklist', 11, 3 ); | |
function filter_gform_email_is_blacklist( $is_spam, $form, $entry ) { | |
if ( $is_spam ) { | |
return $is_spam; | |
} | |
$field_id = '2'; // The ID of the field containing the email address to be checked. | |
$email = rgar( $entry, $field_id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Conditionally requiring (or un-requiring) certain Contact Form fields based on the page its on | |
// https://gist.github.com/spivurno/8481177 | |
function fs_conditional_requirement( $form ) { | |
// homepage | |
if ( is_page(15) ) { | |
foreach( $form['fields'] as &$field ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get dropdown info from Gravity Form PM selections | |
// After the Gravity validates the fields, the Gravity form will re-render all the fields, so the script code you write will not be bind to the new element. | |
// So you need to bind it again (after validation) or use this hook gform_post_render. | |
jQuery(document).on('gform_post_render', function( ){ | |
// and especially whenever it's changed | |
jQuery('.pm-dropdown select').on('change', function() { | |
var pmValueEmail = jQuery(this).val(); | |
var pmTextFullname = jQuery(this).find('option:selected').text(); | |
var pmFirstName = pmTextFullname.split(' ').slice(0, -1).join(' '); | |
// set the hidden text input field value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const res = await fetch('https://app.asana.com/api/1.0/tasks/' + inputData.parentTaskID + '/subtasks', { | |
headers: { | |
'Authorization': 'Bearer 1/1234' | |
} | |
}); | |
// Sends a JSON response composed of the specified data | |
const body = await res.json(); | |
// Grabs the "data" content of the response | |
const data = body.data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is wrapped in an `async` function | |
// you can use await throughout the function | |
var parentTaskID = inputData.parentTaskID ; // get the variable from the parentTaskID | |
// get the subtasks based on the parentTaskID | |
const res = await fetch('https://app.asana.com/api/1.0/tasks/' + parentTaskID + '/subtasks', { | |
method: 'GET', | |
headers: { | |
'Authorization': 'Bearer 1/2345' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ACF Case Study Key Features accordion shortcode recreation, used within the Case Study page template */ | |
// [fs_key_features_accordion] | |
function fs_sc_key_features_accordion( $atts ){ | |
// begin output buffering | |
ob_start(); | |
if( have_rows('cs_key_website_features') ) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const res = await fetch('https://app.asana.com/api/1.0/workspaces/9876543/tasks/search?projects.all=1204442834902858§ions.any=1204442834902861,1204442834902862&completed=false&text=' + inputData.foundText + '&opt_fields=gid', { | |
headers: { | |
'Authorization': 'Bearer 0/1234567' | |
} | |
}); | |
// Sends a JSON response composed of the specified data | |
const body = await res.json(); | |
// Grabs the "data" content of the response | |
const data = body.data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Duplicate the Asana FS:Audit task template that we made (note, it's not a "real" Task Template, but just a straggling task that sits in the project) and set the name based on the task name of the CRM task that got completed earlier. | |
// get taskName from the custom fields above | |
var taskTitle = inputData.taskName; | |
var taskID = "555555555"; // task to duplicate | |
// notes: https://forum.asana.com/t/now-available-project-and-task-duplication/49371 | |
let body = { | |
"data": { | |
"include": [ | |
"assignee", | |
"attachments", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get parameters of URL | |
function getParam(p) { | |
var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search); | |
return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); | |
} | |
// set expiration date | |
function getExpiryRecord(value) { | |
var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds | |
var expiryDate = new Date().getTime() + expiryPeriod; |
NewerOlder