<p>My guess is you probably need to add the root <code>.domain.com</code> to the <a href="https://craftcms.com/docs/config-settings#defaultCookieDomain" rel="nofollow noreferrer">defaultCookieDomain</a> config setting.</p>

CC BY-SA 3.0
2016-11-02T22:16:46.233Z
2016-11-02T22:16:46.233Z
Brad Bell
<p>Our site's control panel needs to be on a subdomain for security purposes. So our <code>baseCpUrl</code> setting in our <code>general.php</code> file is <code>http://craft-admin.domain.com/</code> while our <code>siteUrl</code> is set at <code>http://www.domain.com/</code>. </p>

<p>I'm not able to access user information (specifically if a user is logged in and has <code>accessCp</code> permissions) on the main site. Dumping <code>user</code> information on a template is giving me <code>NULL</code>, I assume because there's no connection being made between <code>craft-admin.domain.com/</code> and <code>www.domain.com/</code>, so pages on <code>www.domain.com</code> can't tell me anything about logged-in users.</p>

<p>I ran into this trying to add in the <a href="https://github.com/wbrowar/adminbar" rel="nofollow noreferrer">Admin Bar plugin</a> so logged-in users can have quicker access to the Control Panel edit screen for a particular page if they're viewing it on the public-facing site. However, since there's no user information being passed along, the admin bar will never show up because it assumes I'm just a regular person browsing the site.</p>

<p>Is there something else I need to do in order to access logged-in user information on the front end if the <code>baseCpUrl</code> is different than the <code>siteUrl</code>?</p>

<users><control-panel><current-user>
Access logged-in user info when `baseCpUrl` is different than `siteUrl`
# Access logged-in user info when `baseCpUrl` is different than `siteUrl`

(Asked by: username_0 on 2016-11-02)

Our site's control panel needs to be on a subdomain for security purposes. So our `baseCpUrl` setting in our `general.php` file is `http://craft-admin.domain.com/` while our `siteUrl` is set at `http://www.domain.com/`.

I'm not able to access user information (specifically if a user is logged in and has `accessCp` permissions) on the main site. Dumping `user` information on a template is giving me `NULL`, I assume because there's no connection being made between `craft-admin.domain.com/` and `www.domain.com/`, so pages on `www.domain.com` can't tell me anything about logged-in users.

I ran into this trying to add in the [Admin Bar plugin](https://github.com/wbrowar/adminbar) so logged-in users can have quicker access to the Control Panel edit screen for a particular page if they're viewing it on the public-facing site. However, since there's no user information being passed along, the admin bar will never show up because it assumes I'm just a regular person browsing the site.

Is there something else I need to do in order to access logged-in user information on the front end if the `baseCpUrl` is different than the `siteUrl`?

**Tags:** users, control-panel, current-user


---

## 1 answers

### Answer by username_1 on 2016-11-02. Score: 0 | Accepted answer

My guess is you probably need to add the root `.domain.com` to the [defaultCookieDomain](https://craftcms.com/docs/config-settings#defaultCookieDomain) config setting.


---

