Topic: Edit page link if logged in?
I'd like to have an "edit this page" link at the bottom of every page if I'm logged in.
(I searched this forum and also checked the documentation but I haven't come up with a good solution).
You are not logged in. Please login or register.
I'd like to have an "edit this page" link at the bottom of every page if I'm logged in.
(I searched this forum and also checked the documentation but I haven't come up with a good solution).
I know for sure u can add button with link which goes to admin/pages with list of all of them in template it will show only if u ar loged in and admin or editor, but idknw how to make the link exactly to the page editing, would be nice to know as well, if u can make that link somehow ill help u hide it from normall users and show only to admin/editor
I did a quick and dirty solution that only works for admin. I put the code in the footer.chunk.php.
(My programming skills are limited and I therefore cannot guarantee that this code is safe to use.)
if (Session::exists('admin') && Session::get('admin') == true) { // check whether admin is logged in and session is active list($part1, $part2, $part3) = explode('/', $_SERVER['REQUEST_URI']); //get the URI and split it into three parts if ($part3 == '') { //if third part is empty give it the value of the second part $part3 = $part2; } $part4 ="edit"; //clumsy :) echo " ".$part4; } else { }
this code works fine on locahost tho
edit"; //clumsy :) echo " ".$part4; } else { } ?>
What does this do
in addition to this?
Is it possible to merge these somehow?
I'm just trying to understand
I have no idea lol, i dont know php at all... I had that code in my notes with explanation of wht it does, so i try to make ur code plus that one to work together and it does, buttons showes only to admin or editor if they loged in, the only problem it works only on plugin pages and it wont work if u ar at yourwebsite.com/index.php only if its has home or any pages after slash otherwise buttons sending u to hell