Answers.Body: <p>Here's an example of accessing an entry's version history that Nathaniel Hammond <a href="https://twitter.com/nfourtythree/status/1126564755852992513" rel="nofollow noreferrer">recently shared on Twitter</a>:</p>
  
  <pre><code>{#
  Options for getVersionsByEntryId
  * @param int $entryId The entry ID to search for.
  * @param int|null $siteId The site ID to search for.
  * @param int|null $1 limit The limit on the number of versions to retrieve.
  * @param bool $includeCurrent Whether to include the current "top" version of the entry.
  * @param bool $withContent Whether the field content should be included on the versions.
  * @return EntryVersion[]
  #}
  {% set entryId = 7 %}
  {% set siteld = null %}
  {% set limit = null %}
  {% set includeCurrent = true %}
  {% set withContent = false %}
  {% set versions = craft.app.entryRevisions.getVersionsByEntryId(entryId, siteId, limit, includeCurrent, withContent) ?? null %}
  
  {% if versions|length %}
    &lt;ul&gt;
      {% for version in versions if version.getCreator() %}
        &lt;li&gt;{{ version.getCreator().username }}&lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;
  {% endif %}
  </code></pre>
  
  <p>In this example he's accessing the version's creator and displaying that, but you could easily swap that out for whatever you need to do, such as grabbing the version creation date etc.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-29T15:16:42.647Z
Answers.Text: Incredible thank you!
Answers.UserDisplayName: alex morris
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-24T11:11:31.807Z
Answers.LastActivityDate: 2019-05-24T11:11:31.807Z
Answers.UserDisplayName: Jalen Davenport
Body: <p>We have some content that needs to display a log of changes (legal docs, terms etc) </p>
  
  <p>Could I use version history for this? </p>
  
  <p>I found this for Craft 2 but doesn't work on 3...</p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/9050/how-can-i-display-entry-edit-history-on-the-front-end">How can I display entry edit history on the front end?</a></p>
  
Tags: <entries><entry-versions>
Title: Show entry version history on front end
ThreadText: # Show entry version history on front end
  
  (Asked by: username_0 on 2019-05-24)
  
  We have some content that needs to display a log of changes (legal docs, terms etc)
  
  Could I use version history for this?
  
  I found this for Craft 2 but doesn't work on 3...
  
  [How can I display entry edit history on the front end?](https://craftcms.stackexchange.com/questions/9050/how-can-i-display-entry-edit-history-on-the-front-end)
  
  **Tags:** entries, entry-versions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-24. Score: 3 | Accepted answer
  
  Here's an example of accessing an entry's version history that Nathaniel Hammond [recently shared on Twitter](https://twitter.com/nfourtythree/status/1126564755852992513):
  
  ```
  {#
  Options for getVersionsByEntryId
  * @param int $entryId The entry ID to search for.
  * @param int|null $siteId The site ID to search for.
  * @param int|null $1 limit The limit on the number of versions to retrieve.
  * @param bool $includeCurrent Whether to include the current "top" version of the entry.
  * @param bool $withContent Whether the field content should be included on the versions.
  * @return EntryVersion[]
  #}
  {% set entryId = 7 %}
  {% set siteld = null %}
  {% set limit = null %}
  {% set includeCurrent = true %}
  {% set withContent = false %}
  {% set versions = craft.app.entryRevisions.getVersionsByEntryId(entryId, siteId, limit, includeCurrent, withContent) ?? null %}
  
  {% if versions|length %}
    <ul>
      {% for version in versions if version.getCreator() %}
        <li>{{ version.getCreator().username }}</li>
      {% endfor %}
    </ul>
  {% endif %}
  
  ```
  
  In this example he's accessing the version's creator and displaying that, but you could easily swap that out for whatever you need to do, such as grabbing the version creation date etc.
  
  > **Comments:**
  > **username_0**: Incredible thank you!  
  
  ---
  
  