From my templates, I want to link to my CPanel. The template is only accessible by those who do have permission to access the CPanel. How do I link to the CPanel from the template? The URL I see generated when I log in seems to include a session id.
2 Answers
Starting from version 2.8.0 you can use standard global variable for this
{cp_session_id}
if you want to make link to edit entry, don't forget about special tag for this which available from version 2.9.0
{cp_edit_entry_url}
You can also output the cp main url (like example.com/admin.php) using global variable (from ee 2.8.0)
{cp_url}
-
So what is the URL? Do I have to build it, adding the session id in the query string? Commented Sep 25, 2014 at 12:02
-
1URL to what? You still don't tell what page you need. If entry - <a href="{cp_edit_entry_url}">Edit Entry</a>. If some other page - copy url from CP, replace session_id with tag + you can replace main cp url with {cp_url}. Or you just want url to CP at is? Commented Sep 25, 2014 at 12:17
You can get the session id via PHP by using
$this->EE->session->userdata['session_id']
You are probably best wrapping this in a plugin