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_after_submission", "post_form_anonymize", 10 , 2); | |
//Gravity Form Submission | |
function post_form_anonymize($entry, $form){ | |
$cssClasses = preg_split('/[\ \n\,]+/', $form['cssClass']); | |
if (in_array("anonymize", $cssClasses)) { | |
RGFormsModel::update_lead_property($entry['id'], "created_by","1"); | |
RGFormsModel::update_lead_property($entry['id'], "ip","XXX.YYY.XXX.YYY"); |
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
//Update after each step completion - probably executes too often for most use cases | |
add_action( 'gravityflow_step_complete', 'gravityflow_step_complete_post_publish', 10, 4 ); | |
function gravityflow_step_complete_post_publish( $step_id, $entry_id, $form_id, $status ) { | |
$entry = GFAPI::get_entry( $entry_id ); | |
$currentPost = get_post( rgar( $entry, 'post_id' ) ); | |
if("draft" == $currentPost->post_status) { |
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_replace_merge_tags', array(&$this, "replace_tally_results"), 10, 7 ); | |
function replace_tally_results( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) { | |
$custom_merge_tag = '{tally_results}'; | |
if ( strpos( $text, $custom_merge_tag ) === false ) { | |
return $text; | |
} | |
$score = array(); | |
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
<?php | |
function ipost_import_roles($employee_ID) { | |
$user_query = new WP_User_Query( array( 'meta_key' => 'employee_id', 'meta_value' => $employee_ID ) ); | |
$defaultRole = array("employee" => true); | |
if ( ! empty( $user_query->results ) ) { | |
foreach ( $user_query->results as $user ) { | |
if( $user->roles ) { | |
$roles = $defaultRole; | |
foreach( $user->roles as $role ) { |
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 | |
//REST API - Enable more fields to be searched via Rest API | |
add_filter( 'rest_query_vars', function ( $valid_vars ) { | |
$update_vars = $valid_vars; | |
//Vehicle Meta Data | |
$update_vars = array_merge( $update_vars, array( 'make', 'meta_query' ) ); | |
$update_vars = array_merge( $update_vars, array( 'model', 'meta_query' ) ); | |
return $update_vars; |
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
(function($) { | |
acf.add_action('ready', function( $el ){ | |
//Identify the field you want to check against. | |
//Use a class to handle scenarios involving repeater / flexible content where multiple instances exist | |
var $field = $('.example input'); | |
$field.on('change', function (evt) { |
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
#!/bin/bash | |
INPUT=input_filename.csv | |
OLDIFS=$IFS | |
IFS=, | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read reviewer employee | |
do | |
f10=$(wp user get $reviewer --field=ID) | |
f11=$(wp user get $employee --field=ID) | |
f14=$(wp user meta get $employee user_meta_field_name) |
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 | |
//replace ## with your form ID - and also update field IDs with your appropriate numbers. | |
add_action( "gform_pre_submission_##", "employee_lookup_and_assignment", 10, 1 ); | |
function employee_lookup_and_assignment( $form ) { | |
$reviewer = get_user_by( 'email', rgpost( 'input_12' )); | |
if( $reviewer ): | |
$_POST['input_10'] = "user_id|" . $reviewer->ID; | |
endif; |
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_action( 'rest_api_init', 'rest_register_game_meta' ); | |
function rest_register_game_meta() { | |
//For generic fields that should never allow front-end updates | |
$restArgsDisplay = array( | |
'get_callback' => 'rest_get_game_meta', | |
'update_callback' => null, | |
'schema' => null, |
OlderNewer