Frontend button to edit page if logged-in as admin

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
geotek
Forum Members
Forum Members
Posts: 14
Joined: Wed Apr 22, 2015 3:16 pm

Frontend button to edit page if logged-in as admin

Post by geotek »

When will it be possible to quickly edit a page via an edit button / link at the frontend page if logged in as admin-user at the backend? This is a standard feature on all major CMSes, as it saves a lot of time and should be easy to implement.

Due to removal of the {edit} tag and the editcontent.php script it seems we have lost this capability in V.2.0.

Please (!!!!!!) give us back this valuable feature!
flmm
Forum Members
Forum Members
Posts: 41
Joined: Wed Mar 24, 2010 1:12 pm

Re: Frontend button to edit page if logged-in as admin

Post by flmm »

Never used this, but I think you want a edit button that links to the page in cmsms backend? You can use your browser cookie and the content_id for this.

Check if the cookie is present and show the button:
{if $smarty.cookies._sx_ != ''}show{/if}

The link url:
{root_url}/admin/editcontent.php?_sx_={$smarty.cookies._sx_}&content_id={$content_id}

With a bit of inline styling to have at the right top of the page and open in new tab:
{if $smarty.cookies._sx_ != ''}<a href="{root_url}/admin/editcontent.php?_sx_={$smarty.cookies._sx_}&content_id={$content_id}" style="position:absolute;top:0;right:20px;background:#fff;padding:8px 15px;border:1px #ddd dotted;margin-top: -2px;color:#333;z-index:9999;" target="_blank">edit</a>{/if}

You can put this in a Global Content Block and put this GCB before the <__body> tag in your template(s).

Update: Sorry, see that they changed the url's, cookies etc. in 2.0. Will try to get it working there as soon as I have 2.0 working.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Frontend button to edit page if logged-in as admin

Post by calguy1000 »

Check out the CGActionBar module.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Frontend button to edit page if logged-in as admin

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
flmm
Forum Members
Forum Members
Posts: 41
Joined: Wed Mar 24, 2010 1:12 pm

Re: Frontend button to edit page if logged-in as admin

Post by flmm »

@Rolf: Thanks for the code, works great :).
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Frontend button to edit page if logged-in as admin

Post by Rolf »

flmm wrote:@Rolf: Thanks for the code, works great :).
Thanks to calguy1000, he wrote it ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Frontend button to edit page if logged-in as admin

Post by Dr.CSS »

Rolf must be mad at me, that link does a '403 Forbidden' for me, his whole site does...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1967
Joined: Mon Jan 29, 2007 4:47 pm

Re: Frontend button to edit page if logged-in as admin

Post by Jo Morg »

Not just you :P... but I think it has to do with either a particular version of FF, or a plugin of it... I can access with any other browser, or by changing my current FF User Agent... probably a scrip that tries to redirect mobiles, or something? :)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Frontend button to edit page if logged-in as admin

Post by Dr.CSS »

AH, I just installed adblocker plus to try to cut down on crap loading in the background on sites, might have something to do with it...

It's not that, I just disabled it and tried, still no go...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1967
Joined: Mon Jan 29, 2007 4:47 pm

Re: Frontend button to edit page if logged-in as admin

Post by Jo Morg »

Upgrade FF! :) it did it for me. I just don't know why it blocked me before though...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Frontend button to edit page if logged-in as admin

Post by Rolf »

Dr.CSS wrote:Rolf must be mad at me...

As if that would be possible... ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
geotek
Forum Members
Forum Members
Posts: 14
Joined: Wed Apr 22, 2015 3:16 pm

Re: Frontend button to edit page if logged-in as admin

Post by geotek »

calguy1000 wrote:Check out the CGActionBar module.
The CGActionBar does not seem to work with V.2.0.1.1. After installing CGActionBar all frontend webpages are blank and appear only after an explicit F5 refresh. Tested with a clean V.2.0.1 installation upgraded to V.2.0.1.1.

The Edit Button code at http://www.cmscanbesimple.org/blog/floa ... -edit-link mentioned by Rolf does not work either because editcontent.php is no longer available in CMSMS V.2.0
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Frontend button to edit page if logged-in as admin

Post by calguy1000 »

The CGActionBar does not seem to work with V.2.0.1.1
Works fine for me, just tested.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Frontend button to edit page if logged-in as admin

Post by calguy1000 »

It took about 2 minutes to fix the edit-content thing for 2.0.
Will release in the next few days.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “The Lounge”