Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
7 posts Page 1 of 1
Usually the moment at which a site-owner decides that a particular page requires some editing is while he is looking at that very page on his site's front-end. To do so, he switches over to the back-end (admin panel) and hunts over for the target page and completes the edit.

The process would be much easier for him if you, as the site-designer, could place a link directly on the page itself clicking which would lead him straight to the admin-panel with the page in question ready for being edited.

It is actually very easy to do using the cms:admin_link tag. This tag has been around for quite sometime now but I don't see many people using it. Following is a snippet that can be placed at an appropriate place in any template to show such a link.
Code: Select all
<cms:if k_user_access_level ge '7' >
  <p><a target="_blank" href="<cms:admin_link />">EDIT</a></p>
</cms:if>

Notice that we output the link only after checking that the user is logged-in as an admin or higher.
@KK - I just love when my questions are answered long before they have even popped up :) Thank you, this works like a charm! ;)
I just came across this while looking through the forum, randomly. It's freaking awesome! This will work perfectly for me! I'm loving CouchCMS more and more :)
KK wrote: Usually the moment at which a site-owner decides that a particular page requires some editing is while he is looking at that very page on his site's front-end. To do so, he switches over to the back-end (admin panel) and hunts over for the target page and completes the edit.

The process would be much easier for him if you, as the site-designer, could place a link directly on the page itself clicking which would lead him straight to the admin-panel with the page in question ready for being edited.

It is actually very easy to do using the cms:admin_link tag. This tag has been around for quite sometime now but I don't see many people using it. Following is a snippet that can be placed at an appropriate place in any template to show such a link.
Code: Select all
<cms:if k_user_access_level ge '7' >
  <p><a target="_blank" href="<cms:admin_link />">EDIT</a></p>
</cms:if>

Notice that we output the link only after checking that the user is logged-in as an admin or higher.
Hi KK,

I've been using this code snippet for a while on my website, and it's been working great. However, I'm not sure if I made some changes or maybe version 1.4 had some changes, but now the button is not persistent while navigating through my site. For example, If I get it to appear on HOME, and then go to ABOUT, it disappears. I have my admin area open in another tab, which is how I was doing it before.

Any ideas what might be causing this?
@webinke,
Nothing has changed in 1.4 that would cause this to happen.
There must some other cause that we need to find.

As a debugging measure, please change the snippet to make it the follows -
Code: Select all
<cms:if k_user_access_level ge '7' >
  <p><a target="_blank" href="<cms:admin_link />">EDIT</a></p>
<cms:else /> 
  <h3>You cannot edit!</h3>
</cms:if>

Now please check that on the pages where you don't see the edit link, do you see the "You cannot edit!" message?

If you do (and you are sure that you are logged-in as admin in the same browser), it is weird behaviour and needs to be looked into.

If, however, you see neither the link nor the message, the problem lies in your template and you are not executing the code at all (probably placed it in a different view).

Keep us posted.
Thanks.
Hi KK,

Thanks for the update. I had a nagging feeling last night that I must have done something, so I went through and deleted whole set up, and replaced with the version I knew I was working. Then I went about and replaced different parts, and it seems to be working again. So I actually have no idea what happened, other than it was me that messed it up (of course).

My guess is that when I did a mass file update, something didn't write correctly. Anyway, as always, thanks for the help!
7 posts Page 1 of 1