ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Checking if a user is logged into the control panel

June 16, 2011 9:26am

Subscribe [3]
  • #1 / Jun 16, 2011 9:26am

    johnny.slack

    4 posts

    I want to be able to show a certain link, but only if a user is logged into the control panel. I’ve tried {if logged_in} and did a var_dump of $this->EE->session->userdata - but they’re empty if I’m logged into the control panel and {if logged_out} always evaluates to true. Is this not the proper way to check if a user is logged into the control panel?

    Thanks!

  • #2 / Jun 17, 2011 12:38am

    John Henry Donovan

    12339 posts

    Hi Johnny,

    the global conditional checks whether a user is logged into the system. It doesn’t differentiate between control panel and front end

    One gotcha is that you may be logged into the control panel at a url with the sub-domain of wwww but you may be viewing the site on the front-end without the www.

    Can you share with us the template code you have tried so far

  • #3 / Jun 17, 2011 5:45am

    johnny.slack

    4 posts

    Ah! No need. It was the www issue. thank you!

  • #4 / Jun 18, 2011 12:30pm

    Greg Salt

    3988 posts

    Hi johnny.slack,

    Glad that John Henry was able to point you in the right direction. I’ll close this thread now but please post again if required.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases