Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.34 #2259

Merged
merged 26 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
901ff07
Adds entries without is_approved meta to the list of unapproved
omarkasem Dec 30, 2024
bc353e2
Removes test code and Fixes test fail
omarkasem Jan 2, 2025
04dcd1d
Removes test code and Fixes test fail (#2251)
zackkatz Jan 2, 2025
bf6b976
Adds approval status to export entries conditional logic
omarkasem Jan 6, 2025
f4c34ad
Fix nullable left join fatal error #2253
zahardev Jan 6, 2025
1acddbc
Declare variable earlier to enhance readibility
mrcasual Jan 7, 2025
bb5e9a2
Update changelog [ci skip]
mrcasual Jan 7, 2025
a18b8a3
Fix nullable left join fatal error #2253 (#2254)
mrcasual Jan 7, 2025
1e85a2c
Revert "Declare variable earlier to enhance readibility"
mrcasual Jan 7, 2025
ffb0d88
Check if the raw merge tag value is an array (#2256)
mrcasual Jan 7, 2025
e260de6
Add unit test
mrcasual Jan 8, 2025
dac5ec3
Merge branch 'develop' into issue/2247-change-the-unapproved-filter-t…
mrcasual Jan 8, 2025
a016ea0
Update changelog
mrcasual Jan 8, 2025
c5563cc
Skip unit test due to inconsistent results
mrcasual Jan 8, 2025
b8c6672
Adds entries without is_approved meta to the list of unapproved (#2248)
mrcasual Jan 8, 2025
f612da8
Merge branch 'develop' into issue/2229-add-gvs-approval-statuses-to-g…
mrcasual Jan 8, 2025
065cccf
Remove unused variable/format code and docblocks
mrcasual Jan 8, 2025
31e18fe
Update changelog [ci skip]
mrcasual Jan 8, 2025
fe3f1d6
Adds approval status to export entries conditional logic (#2252)
mrcasual Jan 8, 2025
bd6838b
Tweak changelog [ci skip]
zackkatz Jan 9, 2025
66d8603
Do not apply site's timezone offset to Date fields (#2257)
mrcasual Jan 9, 2025
2aeed8b
Do not apply site's timezone offset to Date fields (#2258)
mrcasual Jan 10, 2025
46d76a7
Enable Layout Builder
mrcasual Jan 10, 2025
dd2629a
Bump version to 2.34 & update changelog
mrcasual Jan 10, 2025
09da5d2
Readme fixes: link to article, links to modifiers
zackkatz Jan 10, 2025
94680d2
`i-like-clean-slugs` [ci skip]
zackkatz Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions future/lib/class-gamajo-template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ public function get_template_part( $slug, $name = null, $load = true ) {
// Get files names of templates, for given slug and name.
$templates = $this->get_template_file_names( $slug, $name );

if ( $slug == 'note' ) {
$load = false;
}

// Return the part that is found.
return $this->locate_template( $templates, $load, false );
}
Expand Down
4 changes: 2 additions & 2 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: GravityView
* Plugin URI: https://www.gravitykit.com
* Description: The best, easiest way to display Gravity Forms entries on your website.
* Version: 2.33.2
* Version: 2.34
* Requires PHP: 7.4.0
* Author: GravityKit
* Author URI: https://www.gravitykit.com
Expand Down Expand Up @@ -32,7 +32,7 @@
/**
* The plugin version.
*/
define( 'GV_PLUGIN_VERSION', '2.33.2' );
define( 'GV_PLUGIN_VERSION', '2.34' );

/**
* Full path to the GravityView file
Expand Down
5 changes: 5 additions & 0 deletions includes/class-admin-approve-entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,15 @@ public function filter_links_entry_list( $filter_links = array(), $form = array(
);

$field_filters_unapproved = array(
'mode' => 'any',
array(
'key' => GravityView_Entry_Approval::meta_key,
'value' => GravityView_Entry_Approval_Status::UNAPPROVED,
),
array(
'key' => GravityView_Entry_Approval::meta_key,
'value' => '',
),
);

$approved_count = $disapproved_count = $unapproved_count = 0;
Expand Down
81 changes: 25 additions & 56 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,31 @@ public function changelog_screen() {
* - If 4.28, include to 4.26.
*/
?>
<h3>2.34 on January 9, 2025</h3>

<p>This release introduces the <a href="https://www.gravitykit.com/announcing-gravityview-2-34-all-new-layout-builder">Layout Builder</a> that allows creating custom layouts with rows and columns directly in the View editor, adds support for exporting entries by Approval Status, and includes various fixes and improvements.</p>

<h4>🚀 Added</h4>

<ul>
<li>New Layout Builder View type for creating custom layouts with single or multi-column configurations and adjustable widths.</li>
<li>Support for using entry Approval Status in conditional logic rules on the Gravity Forms Export Entries page.</li>
</ul>

<h4>✨ Improved</h4>

<ul>
<li>Entries added via the Gravity Forms API or while GravityView is inactive can now be filtered using the "Unapproved" status on the Entries page.</li>
</ul>

<h4>🐛 Fixed</h4>

<ul>
<li>Fatal error when searching entries by Approval Status in Views joined with another form using the Multiple Forms extension.</li>
li>Some <a href='https://docs.gravitykit.com/article/350-merge-tag-modifiers'>merge tag modifiers</a> (e.g., <code>:maxwords</code>) not being processed.</li>
<li>WordPress's timezone offset not applying to Date field output with the <code>:format</code> merge tag modifier.</li>
</ul>

<h3>2.33.2 on December 31, 2024</h3>

<p>This update removes debugging code from the Entry Notes field.</p>
Expand Down Expand Up @@ -389,62 +414,6 @@ public function changelog_screen() {
<li>Added <code>gravityview/row-added</code> JavaScript event, triggered when a new row is added to a widget or field area.</li>
</ul>

<h3>2.31.1 on November 8, 2024</h3>

<p>This hotfix release resolves display issues with certain View layouts.</p>

<h4>🐛 Fixed</h4>

<ul>
<li>Rendering issue affecting certain View layouts, such as Maps, introduced in the previous release.</li>
</ul>

<h3>2.31 on November 4, 2024</h3>

<p>This release introduces <a href="https://docs.gravitykit.com/article/1027-dynamic-widget-placement?utm_source=gravityview&utm_medium=changelog&utm_campaign=release">flexible widget positioning</a> in Views, enhances entry-in-a-lightbox functionality, and adds support for the Gravity Forms 2.9+ Image Choice field. It also addresses compatibility issues with LiteSpeed, Divi, and LifterLMS, along with various other fixes and improvements.</p>

<h4>🚀 Added</h4>

<ul>
<li>Ability to position widgets in the View editor using predefined layouts, offering a range of single or multi-column configurations with varying widths.</li>
<li>View setting to control what happens when a user clicks the Cancel link when editing an entry in the lightbox.</li>
<li>Support for the upcoming Image Choice field in Gravity Forms 2.9+.</li>
</ul>

<h4>🐛 Fixed</h4>

<ul>
<li>GravityView tab not displaying in certain cases under GravityKit > Settings menu.</li>
<li>Widgets could not be configured after being added to a new, unsaved View.</li>
<li>Compatibility with the Divi theme that prevented the Signature field from being edited on the Edit Entry screen.</li>
<li>Conflict with the LiteSpeed plugin that caused a fatal error when redirecting users after duplicating an entry.</li>
<li>JavaScript enqueued in the site's footer was not executed when editing an entry in the lightbox.</li>
<li>It was not possible to add new entry notes when viewing a single entry in the lightbox.</li>
<li>Validation error displayed when adding merge tags to the Entry Slug setting input in the View editor.</li>
<li>The search box in the Change Entry Creator field did not return results when editing an entry on the Forms > Entries screen.</li>
<li>Fatal error when activating LifterLMS with GravityView active.</li>
<li>Searching across all fields not working as expected when the search value contains special characters or accents (e.g., ä, ß, İ).</li>
</ul>

<h4>🔧 Updated</h4>

<ul>
<li><a href="https://www.gravitykit.com/foundation/">Foundation</a> to version 1.2.20.</li>
</ul>

<h4>💻 Developer Updates</h4>

<ul>
<li>Added <code>gk/gravityview/lightbox/entry/before-output</code> action that fires before the entry content is output in the lightbox.</li>
<li>Added <code>gk/gravityview/lightbox/entry/output/head-before</code> action that fires after the <code>&lt;head&gt;</code> tag is opened.</li>
<li>Added <code>gk/gravityview/lightbox/entry/output/head-after</code> action that fires before the <code>&lt;/head&gt;</code> tag is closed.</li>
<li>Added <code>gk/gravityview/lightbox/entry/output/content-before</code> action that fires after the <code>&lt;body&gt;</code> tag is opened and before the content is rendered.</li>
<li>Added <code>gk/gravityview/lightbox/entry/output/content-after</code> action that fires after the content is rendered and before the footer.</li>
<li>Added <code>gk/gravityview/lightbox/entry/output/footer-after</code> action that fires after the footer and before the closing <code>&lt;/body&gt;</code> tag.</li>
<li>Added <code>gravityview/fields/image_choice/image_markup</code> filter to modify the Image Choice field (Gravity Forms 2.9+) markup.</li>
<li>Added <code>gravityview/fields/image_choice/output_label</code> filter to control whether to display the value or label of an Image Choice field.</li>
</ul>

<p style="text-align: center;">
<a href="https://www.gravitykit.com/changelog/" class="aligncenter button button-primary button-hero" style="margin: 0 auto; display: inline-block; text-transform: capitalize"><?php esc_html_e( 'View change history', 'gk-gravityview' ); ?></a>
</p>
Expand Down
38 changes: 38 additions & 0 deletions includes/class-gravityview-entry-approval.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,44 @@ private function add_hooks() {
add_action( 'gravityview/approve_entries/updated', array( $this, '_trigger_notifications' ) );

add_action( 'check_admin_referer', [ $this, 'resend_gf_notifications' ], 10, 2 );

add_filter( 'gform_field_filters', [ $this, 'add_approval_field_filter' ] );

}

/**
* Adds approval status filter to the filter list (Export Entries conditional logic).
*
* @since 2.34
*
* @param array $filters The existing filters.
* @param array $form The form array.
*
* @return array The modified filters.
*/
public function add_approval_field_filter( $filters ) {
$filters[] = [
'key' => 'is_approved',
'text' => esc_html__( 'Approval Status', 'gk-gravityview' ),
'preventMultiple' => false,
'operators' => [ 'is' ],
'values' => [
[
'value' => '1',
'text' => esc_html__( 'Approved', 'gk-gravityview' ),
],
[
'value' => '2',
'text' => esc_html__( 'Disapproved', 'gk-gravityview' ),
],
[
'value' => '3',
'text' => esc_html__( 'Unapproved', 'gk-gravityview' ),
],
],
];

return $filters;
}

/**
Expand Down
7 changes: 6 additions & 1 deletion includes/class-gravityview-merge-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function cache_merge_tag_modifiers( $text ) {
*/
public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) {
// Process array value for sub-fields like name and address.
if ( $raw_value[ $merge_tag ] ?? null ) {
if ( is_array( $raw_value ) && ( $raw_value[ $merge_tag ] ?? null ) ) {
$raw_value = $raw_value[ $merge_tag ];
}

Expand Down Expand Up @@ -226,6 +226,11 @@ private static function modifier_format( $raw_value, $matches, $value, $field, $
}

if ( $field instanceof GF_Field_Date ) {
if ( false === strpos( $modifier, 'no_tz_offset' ) ) {
$modifier = 'no_tz_offset:' . $modifier;
}

// Skip the timezone offset.
return self::format_date( $raw_value, $modifier );
}

Expand Down
5 changes: 5 additions & 0 deletions includes/fields/class-gravityview-field-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function apply_format_date_modifiers( $return, $raw_value = '', $value =
return $return;
}

// Skip the timezone offset.
if ( false === strpos( $modifier, 'no_tz_offset' ) ) {
$modifier = 'no_tz_offset:' . $modifier;
}

$return = GravityView_Merge_Tags::format_date( $raw_value, $modifier );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ public static function register_style_assets(): void {
}
}

// new GravityView_Layout_Builder();
new GravityView_Layout_Builder();
12 changes: 11 additions & 1 deletion includes/widgets/search-widget/class-search-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,12 +1113,22 @@ public function gf_query_filter( &$query, $view, $request ) {
)
);
$_tmp_query_parts = $_tmp_query->_introspect();

/**
* @var GF_Query_Condition $search_condition
* */
$search_condition = $_tmp_query_parts['where'];

if ( empty( $filter['key'] ) && $search_condition->expressions ) {
$search_conditions[] = $search_condition;
} else {
// If the left condition is empty, it is likely a multiple forms filter. In this case, we should retrieve the search condition from the main form.
if ( ! $search_condition->left && $search_condition->expressions ) {
$search_condition = $search_condition->expressions[0];
}

$left = $search_condition->left;

// When casting a column value to a certain type (e.g., happens with the Number field), GF_Query_Column is wrapped in a GF_Query_Call class.
if ( $left instanceof GF_Query_Call && $left->parameters ) {
// Update columns to include the correct alias.
Expand All @@ -1133,7 +1143,7 @@ public function gf_query_filter( &$query, $view, $request ) {
}, $left->parameters );

$left = new GF_Query_Call( $left->function_name, $parameters );
} else {
} elseif ( $left ) {
$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
$left = new GF_Query_Column( $left->field_id, $left->source, $alias );
}
Expand Down
17 changes: 16 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h

== Changelog ==

= 2.34 on January 9, 2025 =

This release introduces the [Layout Builder](https://www.gravitykit.com/announcing-gravityview-2-34-all-new-layout-builder) that allows creating custom layouts with rows and columns directly in the View editor, adds support for exporting entries by Approval Status, and includes various fixes and improvements.

#### 🚀 Added
* New Layout Builder View type for creating custom layouts with single or multi-column configurations and adjustable widths.
* Support for using entry Approval Status in conditional logic rules on the Gravity Forms Export Entries page.

#### ✨ Improved
* Entries added via the Gravity Forms API or while GravityView is inactive can now be filtered using the "Unapproved" status on the Entries page.

#### 🐛 Fixed
* Fatal error when searching entries by Approval Status in Views joined with another form using the Multiple Forms extension.
* Some [merge tag modifiers](https://docs.gravitykit.com/article/350-merge-tag-modifiers) (e.g., `:maxwords`) not being processed.
* WordPress's timezone offset not applying to Date field output with the `:format` merge tag modifier.

= 2.33.2 on December 31, 2024 =

This update removes debugging code from the Entry Notes field.

#### 🐛 Fixed

* Debugging code being shown in the Entry Notes field output.
* Output of the User Activation field not being sanitized.

Expand Down
32 changes: 32 additions & 0 deletions tests/unit-tests/GravityView_Entry_Approval_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,36 @@ public function test_update_bulk() {
$this->assertFalse( GravityView_Entry_Approval::update_bulk( range( 20000, 20010 ), GravityView_Entry_Approval_Status::APPROVED, $this->form_id ), 'Should have returned false; Invalid entry IDs' );
}

public function test_entry_list_filter_links() {
// Discussion: https://gravitykit.slack.com/archives/C727B06MB/p1736354374221989
$this->markTestSkipped('Flaky test due to $wpdb sometimes returning empty results');

$form = $this->factory->form->create_and_get();

$entry = $this->factory->entry->create_and_get( [ 'form_id' => $form['id'] ] );

$approve_entries = new class extends GravityView_Admin_ApproveEntries { };

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 0, $filter_links[0]['count'] );
$this->assertEquals( 0, $filter_links[1]['count'] );
$this->assertEquals( 1, $filter_links[2]['count'] );

GravityView_Entry_Approval::update_approved( $entry['id'], GravityView_Entry_Approval_Status::APPROVED, $form['id'] );

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 1, $filter_links[0]['count'] );
$this->assertEquals( 0, $filter_links[1]['count'] );
$this->assertEquals( 0, $filter_links[2]['count'] );

GravityView_Entry_Approval::update_approved( $entry['id'], GravityView_Entry_Approval_Status::DISAPPROVED, $form['id'] );

$filter_links = $approve_entries->filter_links_entry_list( [], $form );

$this->assertEquals( 0, $filter_links[0]['count'] );
$this->assertEquals( 1, $filter_links[1]['count'] );
$this->assertEquals( 0, $filter_links[2]['count'] );
}
}
2 changes: 1 addition & 1 deletion tests/unit-tests/GravityView_Future_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -3682,7 +3682,7 @@ public function test_frontend_field_html_notes() {
$field = \GV\Internal_Field::by_id( 'notes' );
$field->update_configuration( array( 'notes' => array( 'view' => true ) ) );
$this->assertStringContainsString( 'gv-has-notes', $renderer->render( $field, $view, null, $entry, $request ) );
#$this->assertStringContainsString( 'this &lt;script&gt;1&lt;/script&gt; is a note :) {entry_id}', $renderer->render( $field, $view, null, $entry, $request ) );
$this->assertStringContainsString( 'this &lt;script&gt;1&lt;/script&gt; is a note :) {entry_id}', $renderer->render( $field, $view, null, $entry, $request ) );

$field->update_configuration( array( 'notes' => array( 'view' => true, 'add' => true ) ) );
#$this->assertStringContainsString( 'gv-add-note-submit', $renderer->render( $field, $view, null, $entry, $request ) );
Expand Down