<p>You can check if the current user can edit an entry by using this  as your conditional:</p>

<pre><code>{% if entry.isEditable() %}
    &lt;a href="{{ entry.cpEditUrl }}"&gt;Edit Page&lt;/a&gt;
{% endif %}
</code></pre>

CC BY-SA 3.0
2014-06-13T16:05:10.110Z
Does that work when adding that to your Base layout? I'm running the conditional in my base layout and it's not showing the link although the current author owns the page I'm testing.
Mark Busnelli Jr
CC BY-SA 3.0
2014-06-13T16:09:49.007Z
If you can access the entry model, then it should work fine. If you're adding it to the layout as opposed to the template you may be running into a scope issue. Try creating a {% block %} where the link should be and add the above code in the template under the newly created block.
Bryan Redeagle
CC BY-SA 3.0
2014-06-13T16:28:13.673Z
Hmmm that's not working for me on the front end. Is there something that I can do something with `{% if currentUser.can('permission') %} ... {% endif %}` ? I just don't know, nor can I find what `can()` can do :) I found `.can('createEntries:5')` but curious if there's a rendition of `.can('editEntries:5')` or something.
Mark Busnelli Jr
CC BY-SA 3.0
2014-06-13T17:26:35.303Z
The above should work. I would need to know way more before I could tell you why it's not. The function is really just a shortcut for a permission check. The one you're looking for is .can('publishEntries:5'). With 5 being the section id.
Bryan Redeagle
CC BY-SA 3.0
2014-06-13T15:47:33.193Z
2014-06-13T15:47:33.193Z
Bryan Redeagle
<p>How would one go about showing a link on the front end if this entry belongs to the current user? I was thinking it had something to do with <a href="http://buildwithcraft.com/docs/templating/usermodel#can" rel="nofollow">the UserModel's <code>can()</code></a>, but I don't see any documentation of it.</p>

<p>Right now I'm showing an "Edit Page" link once someone is logged in, but I don't want to show a that link on a page that the current user doesn't have access to edit.</p>

<p>Any thoughts on this?</p>

<p><em>Edit</em></p>

<p>I was hoping something like this would work but it doesn't :( :</p>

<pre><code>{% if entry.author == currentUser %}
    &lt;a class="btn btn-primary btn-small cp" href="{{ entry.getCpEditUrl() }}"&gt;Edit Page&lt;/a&gt;
{% endif %}
</code></pre>

<users>
How can I grant front-end access to an entry that belongs to the current user?
# How can I grant front-end access to an entry that belongs to the current user?

(Asked by: username_0 on 2014-06-13)

How would one go about showing a link on the front end if this entry belongs to the current user? I was thinking it had something to do with the UserModel's can(), but I don't see any documentation of it.
Right now I'm showing an "Edit Page" link once someone is logged in, but I don't want to show a that link on a page that the current user doesn't have access to edit.
Any thoughts on this?
Edit
I was hoping something like this would work but it doesn't :( :
{% if entry.author == currentUser %}
    Edit Page
{% endif %}

**Tags:** users

---

## 1 answers

### Answer by username_1 on 2014-06-13. Score: 5

You can check if the current user can edit an entry by using this  as your conditional:
{% if entry.isEditable() %}
    Edit Page
{% endif %}

> **Comments:**
> **username_0**: Does that work when adding that to your Base layout? I'm running the conditional in my base layout and it's not showing the link although the current author owns the page I'm testing.  
> **username_1**: If you can access the entry model, then it should work fine. If you're adding it to the layout as opposed to the template you may be running into a scope issue. Try creating a {% block %} where the link should be and add the above code in the template under the newly created block.  
> **username_0**: Hmmm that's not working for me on the front end. Is there something that I can do something with `{% if currentUser.can('permission') %} ... {% endif %}` ? I just don't know, nor can I find what `can()` can do :) I found `.can('createEntries:5')` but curious if there's a rendition of `.can('editEntries:5')` or something.  
> **username_1**: The above should work. I would need to know way more before I could tell you why it's not. The function is really just a shortcut for a permission check. The one you're looking for is .can('publishEntries:5'). With 5 being the section id.  

---

