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 // DO NOT COPY THIS LINE | |
add_filter('gravityview/fields/fileupload/files_array', 'gv_modify_files_output',10,1); | |
function gv_modify_files_output($output_arr){ | |
foreach ($output_arr as $key => $value) { | |
$output_arr[$key]['content'] = '<a href="'.$value['file_path'].'" target="_blank"><span class="dashicons dashicons-media-default"></span></a>'; | |
} | |
return $output_arr; | |
} |
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 // DO NOT COPY THIS LINE | |
add_action( 'gravityview/edit_entry/after_update', 'gk_trigger_gravityexport_feeds', 10, 3 ); | |
function gk_trigger_gravityexport_feeds( $form = array(), $entry_id = array(), $object ) { | |
$form_ids = array( 10, 85, 77 ); | |
// Check if the form ID matches any of the expected values | |
if ( ! in_array( (int) $form['id'], $form_ids ) ) { |
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 // DO NOT COPY THIS LINE | |
add_filter( 'gravityview/math/shortcode/before', function ( $formula ) { | |
preg_match_all( '/~[^~]*?:(\d+(\.\d+)?|[a-z_]+)(:(.*?))?~/mi', $formula, $merge_tags, PREG_SET_ORDER ); | |
foreach ( $merge_tags as $merge_tag ) { | |
$updated_merge_tag = str_replace( '~', '', $merge_tag[0] ); | |
$updated_merge_tag = sprintf( '{%s}', $updated_merge_tag ); | |
$formula = str_replace( $merge_tag[0], $updated_merge_tag, $formula ); |
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 // DO NOT COPY THIS LINE | |
add_filter( 'gform_merge_tag_filter', 'gv_list_columns', 30, 6 ); | |
function gv_list_columns( $value, $merge_tag, $modifier, $field, $raw_value, $format ) { | |
if ( $field->type == 'list' && $merge_tag != 'all_fields' && 'urlify' === $modifier ) { | |
$values = unserialize( $raw_value ); | |
$output = '<ul>'; |
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
add_filter( 'gravityview_fe_search_criteria', function ( $search_criteria ) { | |
if ( empty( $search_criteria['field_filters'] ) ) { | |
return $search_criteria; | |
} | |
foreach ( $search_criteria['field_filters'] as &$filter ) { | |
if ( $filter['value'] == 'Alabama' ) { $filter['value'] = 'AL';} | |
if ( $filter['value'] == 'Alaska' ) { $filter['value'] = 'AK';} | |
if ( $filter['value'] == 'Arizona' ) { $filter['value'] = 'AZ';} |
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 // DO NOT COPY THIS LINE | |
add_action( 'gravityview/approve_entries/disapproved', 'gv_custom_function',10,1); | |
add_action( 'gravityview/approve_entries/unapproved', 'gv_custom_function',10,1); | |
add_action( 'gravityview/approve_entries/updated', 'gv_custom_function',10,1); | |
add_action( 'gravityview/approve_entries/approved', 'gv_custom_function',10,1); | |
function gv_custom_function($entry_id){ | |
$entry = GFAPI::get_entry( $entry_id ); | |
$form = GFAPI::get_form( $entry['form_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 // DO NOT COPY THIS LINE | |
add_filter( 'gform_pre_render', 'gravityview_edit_entry_dont_require_fields' ); | |
add_filter( 'gform_pre_validation', 'gravityview_edit_entry_dont_require_fields' ); | |
function gravityview_edit_entry_dont_require_fields( $form ) { | |
if ( ! class_exists( '\GravityView_View' ) ) { | |
return $form; | |
} |
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 // DO NOT COPY THIS LINE | |
add_filter('gravityview/edit_entry/user_can_edit_entry', 'gv_claim_entry_by_user_data', 20, 3 ); | |
/** | |
* Modify whether the currently logged-in user can edit an entry that was not created by him | |
* | |
* @param boolean $user_can_edit Can the current user edit the current entry? (Default: false) | |
* @param array $entry Gravity Forms entry array | |
* @param int $view_id ID of the view you want to check visibility against {@since 1.15} | |
* |
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 // DO NOT COPY THIS LINE | |
add_filter( 'gravityview/template/table/entry/class', function( $class, $context ) { | |
if ( ! is_user_logged_in() ) { | |
return $class; | |
} | |
$view_id = $context->view->ID; | |
$current_user_id = get_current_user_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 // DO NOT COPY THIS LINE | |
add_action( 'gravityview/approve_entries/updated', 'gv_approval_timestamp', 10, 2 ); | |
function gv_approval_timestamp($entry_id, $status){ | |
if( !class_exists( 'GFAPI' ) ) { | |
gravityview()->log->error( 'GFAPI does not exist' ); | |
return false; | |
} |