Accessing FEU/CC content based on admin session status

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Accessing FEU/CC content based on admin session status

Post by jmcgin51 »

I have a couple of sites that have frontend content that is protected by the combination of FrontEndUsers and CustomContent. When I, as the administrator am logged in to the admin panel and want to view this content on the frontend, it is annoying to have to go manually log in again as an FEU.

I could have just changed my page templates so that they would check for an admin session and would automatically show the protected content if the admin session was active. BUT, I didn't want to do this because there are times when I want to demonstrate to others what the site looks like pre-login and then post-login.

This site is layed out with a login form on each page, and then the protected pages also redirect to a dedicated Login page if the user has not authenticated. All I did was add an IF statement to the Login page to run the excellent "login_as_feu" UDT (http://wiki.cmsmadesimple.org/index.php ... gin_as_feu) if the $smarty.session.cms_admin_username variable matches my admin username.

This way, if I want to demo a login, I can go to any PUBLIC page and log in as any normal authorized user would. But if I want to just view the protected content while working on the site, I can access any protected page directly by URL, and it redirects to the Login page, which logs me in automatically as the desired FEU and then redirects me back to the requested page!

Probably not a very exciting trick, but it works well in my situation...
Post Reply

Return to “Tips and Tricks”