From 1f4f8ce7338f9622c87226adb594dd85d5ae0482 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 14 Feb 2018 12:28:52 -0700 Subject: [PATCH 01/59] Make link HTTPS --- gravityview-info.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravityview-info.php b/gravityview-info.php index e456b75..d1f3fe8 100644 --- a/gravityview-info.php +++ b/gravityview-info.php @@ -66,7 +66,7 @@ class="aligncenter"> ', '' ) ); + echo wpautop( sprintf( esc_html__( '%sGravityView%s is the best way to display Gravity Forms entries on your website.', 'gravity-forms-addons' ), '', '' ) ); ?> From 094effd79b5320c5b2baffb1b0087482faadca54 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 22 Feb 2018 13:09:51 -0700 Subject: [PATCH 02/59] Remove calls to deprecated get_currentuserinfo() function --- gravity-forms-addons.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 8f088a7..1610128 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -701,7 +701,7 @@ static public function lead_detail( $Form, $lead, $allow_display_empty_fields = } global $current_user, $_gform_directory_approvedcolumn; - get_currentuserinfo(); + wp_get_current_user(); $display_empty_fields = ''; $allow_display_empty_fields = true; @@ -2291,7 +2291,7 @@ public static function get_leads( $form_id, $sort_field_number = 0, $sort_direct static function is_current_user( $lead = array() ) { global $current_user; - get_currentuserinfo(); + wp_get_current_user(); return ( (int) $current_user->ID === (int) $lead["created_by"] ); } @@ -2371,7 +2371,7 @@ private static function sort_by_custom_field_query( $form_id, $sort_field_number if ( $limituser ) { - get_currentuserinfo(); + wp_get_current_user(); if ( (int) $current_user->ID !== 0 || ( $current_user->ID === 0 && apply_filters( 'kws_gf_show_entries_if_not_logged_in', apply_filters( 'kws_gf_treat_not_logged_in_as_user', true ) ) ) ) { $where = empty( $search_filter ) ? "WHERE" : "AND"; if ( (int) $current_user->ID === 0 ) { @@ -2506,7 +2506,7 @@ private static function sort_by_default_field_query( $form_id, $sort_field, $sor $user_filter = ''; if ( $limituser ) { - get_currentuserinfo(); + wp_get_current_user(); if ( (int) $current_user->ID !== 0 || ( $current_user->ID === 0 && apply_filters( 'kws_gf_show_entries_if_not_logged_in', apply_filters( 'kws_gf_treat_not_logged_in_as_user', true ) ) ) ) { if ( (int) $current_user->ID === 0 ) { $user_filter = $wpdb->prepare( " AND (created_by IS NULL OR created_by=%d)", $current_user->ID ); @@ -2816,7 +2816,7 @@ static function get_lead_count( $form_id, $search, $star = NULL, $read = NULL, $ $user_filter = ''; if ( $limituser ) { - get_currentuserinfo(); + wp_get_current_user(); if ( (int) $current_user->ID !== 0 || ( $current_user->ID === 0 && apply_filters( 'kws_gf_show_entries_if_not_logged_in', apply_filters( 'kws_gf_treat_not_logged_in_as_user', true ) ) ) ) { if ( ! empty( $current_user->ID ) ) { $user_filter = $wpdb->prepare( " AND l.created_by=%d ", $current_user->ID ); From cbb1aea9977577d8edf8306bcbfd121930f8ef3e Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 22 Feb 2018 13:10:43 -0700 Subject: [PATCH 03/59] Remove code to loading wp-load This may pose possible risks. Better to not include. --- select_directory_columns.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/select_directory_columns.php b/select_directory_columns.php index 0257947..4437bfb 100644 --- a/select_directory_columns.php +++ b/select_directory_columns.php @@ -1,21 +1,5 @@ Date: Thu, 22 Feb 2018 13:11:10 -0700 Subject: [PATCH 04/59] Remove unused function --- select_directory_columns.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/select_directory_columns.php b/select_directory_columns.php index 4437bfb..f363fd5 100644 --- a/select_directory_columns.php +++ b/select_directory_columns.php @@ -340,17 +340,3 @@ public static function get_selectable_entry_meta( $form ) { } $SelectColumns = new GFDirectorySelectColumns(); - -function rg_has_field_id( $id, $field_ids ) { - foreach ( $field_ids as $field_id ) { - if ( is_numeric( $id ) && is_numeric( $field_id ) && intval( $id ) == intval( $field_id ) ) { - return true; - } - if ( $id == $field_id ) { - return true; - } - - } - - return false; -} \ No newline at end of file From 42561985643a52f05c73c42064765af30de98800 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 22 Feb 2018 13:11:35 -0700 Subject: [PATCH 05/59] Remove incorrect whitespace --- select_directory_columns.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select_directory_columns.php b/select_directory_columns.php index f363fd5..a3b59bd 100644 --- a/select_directory_columns.php +++ b/select_directory_columns.php @@ -314,9 +314,9 @@ class="gform_select_column_heading">
- " class="button-primary" onclick="SelectColumns();"/>  " class="button" + " onclick="self.parent.tb_remove();"/>
From 0480802f75004c280fa8fccab3f9ffeec474d01d Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 22 Feb 2018 13:48:33 -0700 Subject: [PATCH 06/59] Convert JS entry action links to using GF actions --- admin.php | 55 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/admin.php b/admin.php index dfdf01d..8a2bc97 100644 --- a/admin.php +++ b/admin.php @@ -39,6 +39,8 @@ function __construct() { add_action( 'admin_head', array( &$this, 'admin_head' ), 1 ); } + add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_entry_link' ), 10, 5 ); + self::process_bulk_update(); } @@ -179,38 +181,41 @@ static private function add_edit_js( $edit_forms = false, $settings = array() ) $( 'ul.menu' ).addClass( 'noaccordion' ); + } ); + + - // Changed from :contains('Delete') to :last-child to work with 1.6 - $( ".row-actions span:last-child" ).each( function () { - var editLink = $( this ).parents( 'tr' ).find( '.column-title a' ).attr( 'href' ); - editLink = editLink + '&screen_mode=edit'; - //alert(); - $( this ).after( '| " href="' + editLink + '">' ); - } ); - - // Changed from :contains('Delete') to :last-child for future-proofing - $( ".row-actions .trash" ).each( function () { - var formID = $( this ).parents( 'tr' ).find( '.column-id' ).text(); + $settings = GFDirectory::get_settings(); - var title = ''; - title = title.replace( '%s', formID ); + if( ! empty( $settings['modify_admin']['ids'] ) ) { - $( this ).after( ' | ?id=' + formID + '&show_field_ids=true&TB_iframe=true&height=295&width=370" class="thickbox form_ids">' ); - } ); - - } ); - + $field_id_url = plugins_url( "field-ids.php", __FILE__ ); + $field_id_url = add_query_arg( array( + 'id' => $form_id, + 'show_field_ids' => 'true', + 'TB_iframe' => 'true', + 'height' => 295, + 'width' => 370 + ), $field_id_url ); + ?> + | " href="" class="thickbox form_ids"> + | " href=""> + Date: Thu, 22 Feb 2018 13:49:15 -0700 Subject: [PATCH 07/59] Fix link to show the entry field IDs --- admin.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin.php b/admin.php index 8a2bc97..a47ea95 100644 --- a/admin.php +++ b/admin.php @@ -206,7 +206,6 @@ function add_edit_entry_link( $form_id, $field_id, $value, $entry, $query_string From e55f2dadac9df9a6cb128fffad4ad8c737f12239 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 22 Feb 2018 13:49:29 -0700 Subject: [PATCH 08/59] Fix the "Edit Entry" links in the Entry Actions --- gravity-forms-lead-creator.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/gravity-forms-lead-creator.php b/gravity-forms-lead-creator.php index 7ccadbe..189bed7 100644 --- a/gravity-forms-lead-creator.php +++ b/gravity-forms-lead-creator.php @@ -1,10 +1,5 @@ Date: Mon, 5 Mar 2018 17:40:19 -0700 Subject: [PATCH 09/59] Escape strings --- gravity-forms-addons.php | 10 +++++----- template-row.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 1610128..906e776 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -1475,8 +1475,8 @@ public static function make_directory( $atts ) { + + var columns = new Array(); + + function SelectColumns() { + jQuery("#sortable_selected li").each(function () { + columns.push(this.id); + }); + self.ChangeColumns(columns); + } +
- "id", - "label" => esc_html__( "Entry Id", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "date_created", - "label" => esc_html__( "Entry Date", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "ip", - "label" => esc_html__( "User IP", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "source_url", - "label" => esc_html__( "Source Url", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "payment_status", - "label" => esc_html__( "Payment Status", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "transaction_id", - "label" => esc_html__( "Transaction Id", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "payment_amount", - "label" => esc_html__( "Payment Amount", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "payment_date", - "label" => esc_html__( "Payment Date", "gravity-forms-addons" ), - ) ); - array_push( $form["fields"], array( - "id" => "created_by", - "label" => esc_html__( "User", "gravity-forms-addons" ), - ) ); - - $form = self::get_selectable_entry_meta( $form ); - ?> -
-

-

[directory form="' . $form_id . '"]' ); ?>

-
-
-
-
-
-
    + 'id', 'label' => __( 'Entry Id', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'date_created', 'label' => __( 'Entry Date', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'ip', 'label' => __( 'User IP', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'source_url', 'label' => __( 'Source Url', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'payment_status', 'label' => __( 'Payment Status', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'transaction_id', 'label' => __( 'Transaction Id', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'payment_amount', 'label' => __( 'Payment Amount', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'payment_date', 'label' => __( 'Payment Date', 'gravity-forms-addons' ) ) ); + array_push( $form['fields'], array( 'id' => 'created_by', 'label' => __( 'User', 'gravity-forms-addons' ) ) ); + + $form = self::get_selectable_entry_meta( $form ); + $form = GFFormsModel::convert_field_objects( $form ); + ?> +
    +

    +

    [directory form="' . $form_id . '"]' ); ?>

    +
    +
    +
    +
    +
      $field_info ) { ?> -
    • +
    • -
    -
    +
+
-
+
-
-
-
    +
    +
    +
      id, $field_ids ) ) { ?> -
    • ">
    • +
    • get_entry_inputs(); + + if ( is_array( $inputs ) ) { + foreach ( $inputs as $input ) { + if ( rgar( $input, 'isHidden' ) ) { + continue; + } + + if ( ! in_array( $input['id'], $field_ids ) && ! ( $field->type == 'creditcard' && in_array( $input['id'], array( floatval( "{$field->id}.2" ), floatval( "{$field->id}.3" ), floatval( "{$field->id}.5" ) ) ) ) ) { ?> -
    • ">()
    • +
    • displayOnly && ! in_array( $field->id, $field_ids ) && RGFormsModel::get_input_type( $field ) != 'list' ) { ?> -
    • ">
    • +
    • -
    -
    -
- -
- class="button-primary" onclick="SelectColumns();"/>  - " class="button" - " - onclick="self.parent.tb_remove();"/> -
-
- + +
+ + +
+   + +
+ + Date: Tue, 6 Mar 2018 16:33:29 -0700 Subject: [PATCH 51/59] Fix showing entry meta --- template-row.php | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/template-row.php b/template-row.php index 8961e29..eafbcc1 100644 --- a/template-row.php +++ b/template-row.php @@ -34,6 +34,22 @@ $field = RGFormsModel::get_field( $form, $field_id ); + if( $field ) { + $value = RGFormsModel::get_lead_field_value( $lead, $field ); + + if ( GFCommon::is_post_field( $field ) ) { + $input_type = $field->type; + } else { + $input_type = $field->get_input_type(); + } + + } else { + $value = rgar( $lead, $field_id ); + $input_type = $field_id; + } + + $display_value = $value; + $lightboxclass = ''; if ( ! empty( $lightboxsettings['images'] ) ) { @@ -44,9 +60,6 @@ } } - $value = RGFormsModel::get_lead_field_value( $lead, $field ); - $display_value = $value; - /** * @since 3.6.3 */ @@ -55,15 +68,6 @@ $display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $lead, $form ); } - // `id`, `ip`, etc. - if ( ! is_numeric( $field_id ) ) { - $input_type = $field_id; - } elseif ( GFCommon::is_post_field( $field ) ) { - $input_type = $field['type']; - } else { - $input_type = RGFormsModel::get_input_type( $field ); - } - switch ( $input_type ) { case "business_hours": @@ -83,7 +87,7 @@ if ( $input_type === 'address' && $appendaddress ) { $address['id'] = floor( (int) $field_id ); $address[ $field_id ] = $value; - if ( $hideaddresspieces ) { + if ( ! empty( $hideaddresspieces ) ) { $value = NULL; } } else { @@ -143,8 +147,8 @@ if ( in_array( 'urls', $lightboxsettings ) || ! empty( $lightboxsettings['urls'] ) ) { $lightboxclass .= ' rel="directory_all directory_urls"'; } - if ( $linkwebsite ) { - $value = ".../" . esc_attr( GFCommon::truncate_url( $lead["source_url"] ) ) . ""; + if ( ! empty( $linkwebsite ) ) { + $value = ".../" . esc_attr( GFCommon::truncate_url( $lead["source_url"] ) ) . ""; } else { $value = esc_attr( GFCommon::truncate_url( $lead["source_url"] ) ); } @@ -175,7 +179,7 @@ break; case "date" : - if ( $dateformat ) { + if ( ! empty( $dateformat ) ) { $value = GFCommon::date_display( $value, $dateformat ); } else { $value = GFCommon::date_display( $value, $field["dateFormat"] ); @@ -192,7 +196,6 @@ default: $input_type = 'text'; - if ( is_email( $value ) && $linkemail ) { $value = "$value"; } elseif ( preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $value ) && $linkwebsite ) { From cf8a600ff9b5a0a1f911cb14c0f03103afca138b Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Tue, 6 Mar 2018 20:32:18 -0700 Subject: [PATCH 52/59] Fix saving Directory Columns --- gravity-forms-addons.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 42aa621..722f034 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -193,6 +193,12 @@ public static function init() { self::add_rewrite(); + add_action( 'wp_ajax_rg_update_feed_active', array( 'GFDirectory', 'update_feed_active' ) ); + add_action( 'wp_ajax_gf_select_directory_form', array( 'GFDirectory', 'select_directory_form' ) ); + add_action( 'wp_ajax_rg_update_approved', array( 'GFDirectory', 'directory_update_approved_hook' ) ); + add_action( 'wp_ajax_change_directory_columns', array( 'GFDirectory', 'change_directory_columns' ) ); + add_filter( 'plugin_action_links', array( 'GFDirectory', 'settings_link' ), 10, 2 ); + if ( ! self::is_gravityforms_supported() ) { return; } @@ -229,15 +235,6 @@ public static function init() { } else if ( self::is_gravity_page( 'gf_entries' ) ) { wp_enqueue_script( 'thickbox', array( 'jquery' ) ); add_filter( "gform_get_field_value", array( 'GFDirectory', 'add_lead_approved_hidden_input' ), 1, 3 ); - } else if ( in_array( RG_CURRENT_PAGE, array( "admin-ajax.php" ) ) ) { - add_action( 'wp_ajax_rg_update_feed_active', array( 'GFDirectory', 'update_feed_active' ) ); - add_action( 'wp_ajax_gf_select_directory_form', array( 'GFDirectory', 'select_directory_form' ) ); - add_action( 'wp_ajax_rg_update_approved', array( 'GFDirectory', 'directory_update_approved_hook' ) ); - add_action( 'wp_ajax_change_directory_columns', array( 'GFDirectory', 'change_directory_columns' ) ); - } else if ( in_array( RG_CURRENT_PAGE, array( "plugins.php" ) ) ) { - - add_filter( 'plugin_action_links', array( 'GFDirectory', 'settings_link' ), 10, 2 ); - } } From 26c589415541fb6396c01d3a3484180cba9cd080 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Tue, 6 Mar 2018 20:32:46 -0700 Subject: [PATCH 53/59] Fix error when trying to show entry that doesn't exist --- gravity-forms-addons.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 722f034..e008f9d 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -1062,10 +1062,11 @@ static public function process_lead_detail( $inline = true, $entryback = '', $sh list( $formid, $leadid ) = self::get_form_and_lead_ids(); - if ( ! is_null( $leadid ) && ! is_null( $formid ) ) { + $lead = is_null( $leadid ) ? false : apply_filters( 'kws_gf_directory_lead_detail', RGFormsModel::get_lead( (int) $leadid ) ); + + if ( $lead && ! is_null( $formid ) ) { $form = apply_filters( 'kws_gf_directory_lead_detail_form', RGFormsModel::get_form_meta( (int) $formid ) ); - $lead = apply_filters( 'kws_gf_directory_lead_detail', RGFormsModel::get_lead( (int) $leadid ) ); if ( empty( $approvedcolumn ) ) { $approvedcolumn = self::get_approved_column( $form ); @@ -1078,7 +1079,7 @@ static public function process_lead_detail( $inline = true, $entryback = '', $sh //since 3.5 $lead = self::remove_hidden_fields( array( $lead ), $adminonlycolumns, $approvedcolumn, true, true, $showadminonly, $form ); - $lead = $lead[0]; + $lead = isset( $lead[0] ) ? $lead[0] : false; ob_start(); // Using ob_start() allows us to filter output @@ -2706,6 +2707,12 @@ static function remove_hidden_fields( $leads, $admin_only, $approved, $is_leads, if ( $is_leads ) { foreach ( $leads as $index => $lead ) { + + if ( ! $lead ) { + unset( $leads[ $index ] ); + continue; + } + // the field_ids are the numeric array keys of a lead $field_ids = array_filter( array_keys( $lead ), 'is_int' ); From ae50d096eaff72faaf43993684697b5518d83601 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Tue, 6 Mar 2018 20:32:53 -0700 Subject: [PATCH 54/59] Escape HTML --- gravity-forms-addons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index e008f9d..2ebae9c 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -2107,7 +2107,7 @@ static public function settings_link( $links, $file ) { $this_plugin = plugin_basename( __FILE__ ); } if ( $file == $this_plugin ) { - $settings_link = '' . __( 'Settings', 'gravity-forms-addons' ) . ''; + $settings_link = '' . esc_html__( 'Settings', 'gravity-forms-addons' ) . ''; array_unshift( $links, $settings_link ); // before other links } From 67a7445dec835eb212cffe8c9ca01d57ebc96a1a Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 7 Mar 2018 14:07:49 -0700 Subject: [PATCH 55/59] Fix is_callable to make sure the method exists --- gravity-forms-addons.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 2ebae9c..edbcbf5 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -509,7 +509,7 @@ static function directory_update_approved( $lead_id = 0, $approved = 0, $form_id gform_update_meta( $lead_id, 'is_approved', $approved ); } - if( ! is_callable( array( 'GFAPI', 'update_entry_field' ) ) ) { + if( ! method_exists( array( 'GFAPI', 'update_entry_field' ) ) ) { GFCommon::log_error( "Cannot update approval; update_entry_field not available in Gravity Forms" ); return; } @@ -2802,7 +2802,7 @@ public static function save_lead( $form, &$lead ) { } - if( is_callable( array( 'GFFormsModel', 'get_entry_meta_table_name' ) ) ) { + if( method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { $entry_meta_table = RGFormsModel::get_entry_meta_table_name(); $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, meta_key FROM $entry_meta_table WHERE entry_id=%d", $lead['id'] ) ); } else { @@ -2857,7 +2857,7 @@ public static function save_lead( $form, &$lead ) { } } - if( is_callable( 'GFFormsModel', 'commit_batch_field_operations' ) ) { + if( method_exists( 'GFFormsModel', 'commit_batch_field_operations' ) ) { GFFormsModel::commit_batch_field_operations(); } @@ -2867,7 +2867,7 @@ public static function save_lead( $form, &$lead ) { if ( ! empty( $calculation_fields ) ) { - if( is_callable( 'GFFormsModel', 'begin_batch_field_operations' ) ) { + if( method_exists( 'GFFormsModel', 'begin_batch_field_operations' ) ) { GFFormsModel::begin_batch_field_operations(); } @@ -2884,7 +2884,7 @@ public static function save_lead( $form, &$lead ) { } } - if( is_callable( 'GFFormsModel', 'commit_batch_field_operations' ) ) { + if( method_exists( 'GFFormsModel', 'commit_batch_field_operations' ) ) { GFFormsModel::commit_batch_field_operations(); } @@ -2894,7 +2894,7 @@ public static function save_lead( $form, &$lead ) { //saving total field as the last field of the form. if ( ! empty( $total_fields ) ) { - if( is_callable( 'GFFormsModel', 'begin_batch_field_operations' ) ) { + if( method_exists( 'GFFormsModel', 'begin_batch_field_operations' ) ) { GFFormsModel::begin_batch_field_operations(); } @@ -2905,7 +2905,7 @@ public static function save_lead( $form, &$lead ) { } - if( is_callable( 'GFFormsModel', 'commit_batch_field_operations' ) ) { + if( method_exists( 'GFFormsModel', 'commit_batch_field_operations' ) ) { GFFormsModel::commit_batch_field_operations(); } } From 3fbe07f1b50c89478a44919992423b9f8fa6a918 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 7 Mar 2018 14:08:01 -0700 Subject: [PATCH 56/59] Clean up code --- gravity-forms-addons.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index edbcbf5..e86c270 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -1062,9 +1062,9 @@ static public function process_lead_detail( $inline = true, $entryback = '', $sh list( $formid, $leadid ) = self::get_form_and_lead_ids(); - $lead = is_null( $leadid ) ? false : apply_filters( 'kws_gf_directory_lead_detail', RGFormsModel::get_lead( (int) $leadid ) ); + $lead = apply_filters( 'kws_gf_directory_lead_detail', GFAPI::get_entry( $leadid ) ); - if ( $lead && ! is_null( $formid ) ) { + if ( $lead && ! is_wp_error( $lead ) && ! is_null( $formid ) ) { $form = apply_filters( 'kws_gf_directory_lead_detail_form', RGFormsModel::get_form_meta( (int) $formid ) ); From c0fffa98dd46653ecdb296f0b7c6ae679242ab6c Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 7 Mar 2018 14:17:34 -0700 Subject: [PATCH 57/59] Fix issue where DB wasn't upgraded yet, but code was available --- gravity-forms-addons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index e86c270..6219a3b 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -2802,7 +2802,7 @@ public static function save_lead( $form, &$lead ) { } - if( method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { + if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { $entry_meta_table = RGFormsModel::get_entry_meta_table_name(); $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, meta_key FROM $entry_meta_table WHERE entry_id=%d", $lead['id'] ) ); } else { From 0efa0edd90559f5bdab28ba81c9f3afd1ba13c9a Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 7 Mar 2018 14:17:45 -0700 Subject: [PATCH 58/59] Fix method_exists call --- gravity-forms-addons.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gravity-forms-addons.php b/gravity-forms-addons.php index 6219a3b..ee46d2c 100644 --- a/gravity-forms-addons.php +++ b/gravity-forms-addons.php @@ -509,7 +509,7 @@ static function directory_update_approved( $lead_id = 0, $approved = 0, $form_id gform_update_meta( $lead_id, 'is_approved', $approved ); } - if( ! method_exists( array( 'GFAPI', 'update_entry_field' ) ) ) { + if( ! method_exists( 'GFAPI', 'update_entry_field' ) ) { GFCommon::log_error( "Cannot update approval; update_entry_field not available in Gravity Forms" ); return; } @@ -2902,7 +2902,6 @@ public static function save_lead( $form, &$lead ) { GFCommon::log_debug( "Saving total field." ); RGFormsModel::save_input( $form, $total_field, $lead, $current_fields, $total_field->id ); - } if( method_exists( 'GFFormsModel', 'commit_batch_field_operations' ) ) { From 119af10766a7f1382161657ba7c74419f0d16186 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Wed, 7 Mar 2018 14:20:51 -0700 Subject: [PATCH 59/59] Add active development note --- readme.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 39bc380..d4f3dab 100644 --- a/readme.txt +++ b/readme.txt @@ -13,7 +13,7 @@ Add directory capabilities and other functionality to the great Gravity Forms pl > #### [GravityView](https://gravityview.co/?utm_source=wordpress&utm_medium=readme&utm_campaign=readme) is the best way to display Gravity Forms entries > -> We set out to make a better Directory plugin, and we did it: GravityView is a brand-new plugin that takes displaying your form entries to the next level. It is easier, more powerful and more customizable than the Directory plugin. You'll *love* GravityView. +> We set out to make a better Directory plugin, and we did it: GravityView takes displaying your form entries to the next level. It is easier, more powerful and more customizable than the Directory plugin. You'll *love* GravityView. > > [Check out GravityView](https://gravityview.co/?utm_source=wordpress&utm_medium=readme&utm_campaign=readme) or [try a demo](http://demo.gravityview.co?utm_source=wordpress&utm_medium=readme&utm_campaign=readme) today! @@ -230,6 +230,8 @@ Since 3.6.3, the Directory plugin displays formatted values (like currency). To A big update to make Gravity Forms Directory compatible with Gravity Forms 2.3, and to fix entry approval. +**Gravity Forms Directory is not under active development.** We're focusing on [GravityView](https://gravityview.co), which is a way better plugin! Try it out for 30 days, if you don't like it, we'll give you your money back. + ** New: ** - Compatible with Gravity Forms 2.3