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, |
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
<?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 | |
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 | |
add_filter( "gform_rest_api_capability_get_entries", "gfapi2_authorization_by_form", 10, 2); | |
function gfapi2_authorization_by_form( $capability, $request ) { | |
$form_id = $request->get_param("form_id"); | |
if( $form_id == '16' ) { | |
$capability = 'read'; | |
} | |
return $capability; | |
} |
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( 'gravityflow_columns_status_table', 'custom_column_titles', 10, 3 ); | |
function custom_column_titles( $columns, $args, $table ) { | |
$columns['last_updated'] = 'Last Updated'; | |
return $columns; | |
} | |
add_filter( 'gravityflow_field_value_status_table', 'custom_column_field_values', 10, 4 ); | |
function custom_column_field_values( $value, $form_id, $column_name, $entry ) { |
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( 'gravityflow_workflow_complete', 'workflow_finish_complete_status', 5, 3 ); | |
function workflow_finish_complete_status( $entry_id, $form, $final_status ) { | |
if ( $form['id'] == '31' ) { | |
if ( $final_status == 'approved' ) { | |
$entry = GFAPI::get_entry( $entry_id ); | |
if ( $entry ) { | |
$entry['workflow_final_status'] = 'complete'; | |
$result = GFAPI::update_entry( $entry ); |
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('gravityflow_inbox_args', 'registrations_inbox_form_ids', 10, 1); | |
function registrations_inbox_form_ids( $args ) { | |
//Specify which instance of the shortcode you want to affect | |
if( false !== strpos($args['detail_base_url'], '/event-registrations/') ) { | |
$registrations = array( '106, '107'); | |
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; |
OlderNewer