<p>You can check if the current entry's author is the <code>currentUser</code>.</p>

<pre><code>{% if entry.author.id == currentUser.id %}
    {# User can edit entry #}
{% endif %}
</code></pre>

CC BY-SA 4.0
2018-10-30T13:31:59.450Z
Thank you!
It turned out, I needed to enable the other options, and check if the user was related to another entry to verify the ability to edit/delete.
Damon
CC BY-SA 4.0
2018-10-29T23:41:25.100Z
2018-10-29T23:41:25.100Z
Simon Kuran
<p>I have a front-end form that registered users can log into and edit entries.</p>

<p>I am checking for the correct user group, then also checking for the permission:</p>

<pre><code>{% if currentUser.isInGroup('myGroup') %}

    {# Get the entry #}
    {% set request = craft.app.request.segment(3) %}
    {% set entry = craft.entries.section('mySection').slug(request).one() %}

    {% if entry|length &gt; 0 %}
        {% if currentUser.can('editEntries:7') %}
          {# user can edit the current entry #}
        {% endif %}
    {% endif %}

{% endif %}
</code></pre>

<p>All is fine, but if I change the url to another valid url (where the logged in user is not the author) I am still able to see the entry.</p>

<p>Is there a way to prevent that? Is it as easy as just checking/comparing authors? Or is there a more eloquent way? I do have other permissions disabled...
<a href="https://i.sstatic.net/E3Dr3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E3Dr3.png" alt="enter image description here"></a></p>

<p>Thank you for any suggestions!</p>

<craft3>
How can I only allow authors to edit their own entires via front-end?
# How can I only allow authors to edit their own entires via front-end?

(Asked by: username_0 on 2018-10-29)

I have a front-end form that registered users can log into and edit entries.
I am checking for the correct user group, then also checking for the permission:
{% if currentUser.isInGroup('myGroup') %}

    {# Get the entry #}
    {% set request = craft.app.request.segment(3) %}
    {% set entry = craft.entries.section('mySection').slug(request).one() %}

    {% if entry|length > 0 %}
        {% if currentUser.can('editEntries:7') %}
          {# user can edit the current entry #}
        {% endif %}
    {% endif %}

{% endif %}

All is fine, but if I change the url to another valid url (where the logged in user is not the author) I am still able to see the entry.
Is there a way to prevent that? Is it as easy as just checking/comparing authors? Or is there a more eloquent way? I do have other permissions disabled...

Thank you for any suggestions!

**Tags:** craft3


---

## 1 answers

### Answer by username_1 on 2018-10-29. Score: 2 | Accepted answer

You can check if the current entry's author is the currentUser.
{% if entry.author.id == currentUser.id %}
    {# User can edit entry #}
{% endif %}

> **Comments:**
> **username_0**: Thank you! It turned out, I needed to enable the other options, and check if the user was related to another entry to verify the ability to edit/delete.  

---

