how to display entry revisions on the front end

How to Display Entry Revisions on the Front End Using GravityView

Written by Casey Burridge

Last updated:

Categories Entry Revisions

GravityView is an add-on for Gravity Forms that allows you to display your form submissions on the front end of your website. GravityView is flexible and powerful, allowing you to build all kinds of Gravity Forms-powered applications.

In this post, we’re going to look at how GravityView integrates with Entry Revisions, allowing you to display entry revisions on the front end. This helps you track changes made to Gravity Forms entries and restore prior versions if needed.

Here’s what we’re going to cover in this post:

  • Setting up a View with GravityView
  • The Gravity Forms Entry Revisions Plugin
  • The GravityView Custom Content Field
  • Entry Revisions merge tags

Let’s get started! 😁

Setting Up a View With GravityView

GravityView gives you the ability to create Views. A View is a custom post type that allows you to display Gravity Forms data on the front end. GravityView also allows users to edit Gravity Forms entries from the front end.

But that’s not all.

GravityView has a special Custom Content field that allows you to add HTML, shortcodes, or other custom content to your View layouts. This gives you full control over what information you display on the front end.

In this post, we’re going to show you how to use the Custom Content field to display entry revisions on the front end. But first…

Entry Revisions for Gravity Forms

The Entry Revisions plugin for Gravity Forms adds the ability to track changes made to form submissions and easily restore prior iterations.

The plugin comes as part of our All Access license and it’s also available for purchase on our website. With Entry Revisions, you can:

  • View a complete history of your form entries
  • See who made changes to an entry and when
  • Restore field values from a prior version of the entry
  • And… display entry revisions on the front end!

Okay, let’s have a look at the GravityView custom content field and how you can use it to display entry revisions inside your Views.

The GravityView Custom Content Field

The Custom Content field contains a text editor that allows you to add HTML, plain text, shortcodes, or other dynamic content to your Views. This provides huge flexibility when designing View layouts and it also allows you to display entry revisions on the front end.

To add a Custom Content field to your View, click on the + Add Field button and select Custom Content

An arrow pointing to the GravityView Custom Content field

Okay, now let’s look at how we can use Entry Revisions merge tags inside a Custom Content field to display entry revisions on the front end!

Entry Revisions Merge tags

The Entry Revisions plugin adds three new merge tags, allowing you to display entry revisions in different ways. 

Note: Gravity Forms merge tags display the value submitted for a specific form field, but they can also be used to dynamically pull content from other sources. Merge tags are similar to shortcodes but they are specific to Gravity Forms-related content. While shortcodes use [square braces], merge tags use {curly braces}.

There are three Entry Revisions merge tags:

  • {entry_revision_list}
  • {entry_revision_diff}
  • {entry_revision_all_fields}

By adding these merge tags into a custom content field, you can display entry revisions on the front end in different ways. To add a merge tag to your Custom Content field, either copy and paste it into the text editor or click the button on the right of the text editor and select the merge tag you want to add.

The "entry revision list" merge tag inside a Custom Content field

Okay, let’s take a look at each merge tag in a bit more detail…

The {entry_revision_list} Merge Tag

Adding this merge tag to your View will show a bulleted list of changes made to an entry over time. Next to each revision, you’ll see a thumbnail-sized image of the user who made the change, the date the change was made, and a link to view the revision in detail.

A list of entry revisions displayed on the front end inside a View

The {entry_revision_diff} Merge Tag

The {entry_revision_diff} merge tag displays a side-by-side comparison of the fields that have changed between the current entry and the most recent revision.

A side-by-side comparison of changes made to an entry inside a View below the Single Entry

For this article, we added some custom styling to highlight the deletions and make the output pop on the page. If you’d like to do the same, here’s the CSS code we used.

.diff-deletedline,.diff-addedline { 
    font-family: Consolas, Monaco, monospace; 
}

.diff-deletedline del {
    text-decoration: none;
    background-color: #b3d9ff;
}

.diff-addedline ins {
    text-decoration: none;
    background-color: #B2FFA6;
}

table.gv-entry-diff .diff-deletedline {
    background-color: #fafcff;
    border: 1px solid #dcdcdc;
}

table.gv-entry-diff .diff-addedline {
    background-color:#F4FFF2;
}

The {entry_revision_all_fields} Merge Tag

Lastly, the {entry_revision_all_fields} merge tag will show a table containing all the values from the most recent revision. The output from this merge tag looks identical to the Gravity Forms {all_fields} Merge Tag. It also supports the {all_fields} Merge Tag modifiers.

A table displaying all the values from the most recent revision of an entry

Conclusion

GravityView integrates seamlessly with Entry Revisions, allowing you to display Gravity Forms entry revisions on the front end of your website.

By creating a View with a Content Custom field and inserting one of the three Entry Revisions merge tags, you can display revisions in different ways on the front end. It’s this flexibility that makes GravityView such a popular and powerful add-on for Gravity Forms.

Already using GravityView on your website? Upgrade to All Access and start using Entry Revisions today!