Answers.Body: <p>Per Brad's request. I am answering my own question.</p>
  
  <p>I figured out that I was logging in via non-www, and accessing the site at www.</p>
  
  <p>So the official answer is to choose either www or non-www. I chose to remove the www from the URL.</p>
  
  <p>Here's my .htaccess for that, including allowing for fonts to be accessed cross domain, as I had issues with this as well.</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      # Remove www
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  &lt;/IfModule&gt;
  
  &lt;FilesMatch "\.(eot|ttf|otf|woff|svg)"&gt;
      Header set Access-Control-Allow-Origin "*"
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p><strong>Note!!!</strong> Once this is done, make sure to clear your Craft cache., especially if using fonts/font-icons.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-24T20:26:51.340Z
Answers.LastActivityDate: 2016-08-24T20:26:51.340Z
Answers.UserDisplayName: Erik
Body: <p>Does anyone know why <code>currentUser</code> would return null? I'm logged in as an admin.. actually the only user.</p>
  
  <p>I've cleared cache, logged out and back in, etc. I can't seem to get it to work.</p>
  
  <p>I'm trying to set an edit link for an entry like so:</p>
  
  <pre><code>{% if currentUser %}
      &lt;a href="{{ entry.cpEditUrl }}"&gt;
          Edit
      &lt;/a&gt;
  {% endif %}
  </code></pre>
  
  <p>And also tried this:</p>
  
  <pre><code>{% if entry.isEditable() %}
      &lt;a href="{{ entry.cpEditUrl }}"&gt;
          Edit
      &lt;/a&gt;
  {% endif %}
  </code></pre>
  
  <p>Neither are working. Any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:16:11.563Z
Comments.Text: Is this in the context or a normal template request? i.e. you're not doing something edge case like trying to add this code inside of a redirect Twig tag or something similar?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:38:23.733Z
Comments.Text: Normal template request. It was working fine the other day. I have looked through all my git commits, turned off plugins, etc and I cannot get it working again.
Comments.UserDisplayName: Erik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:49:19.727Z
Comments.Text: Hate to ask the obvious, but you're positive you're logged in?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:56:28.227Z
Comments.Text: Yes, absolutely positive.
Comments.UserDisplayName: Erik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:57:32.327Z
Comments.Text: Did you happen to update Craft between the time it was working and now?  If so, do you remember the version you were on?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T18:58:36.143Z
Comments.Text: I may have figured it out. I was logged in with non-www. But going to the front end with www. Is there a way to make Craft not care about www?
Comments.UserDisplayName: Erik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T20:06:21.160Z
Comments.Text: You'd be better off picking either www or non-www as the canonical domain and forcing a rewrite from the other to that one: https://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way - better for SEO as well because Google will index both as 2 separate sites instead of 1.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-24T20:06:45.303Z
Comments.Text: Be sure and add an official answer as well. ;)
Comments.UserDisplayName: Brad Bell
Tags: <templating><usermodel>
Title: currentUser global is null. I can't figure out why
ThreadText: # currentUser global is null. I can't figure out why
  
  (Asked by: username_0 on 2016-08-24)
  
  Does anyone know why `currentUser` would return null? I'm logged in as an admin.. actually the only user.
  
  I've cleared cache, logged out and back in, etc. I can't seem to get it to work.
  
  I'm trying to set an edit link for an entry like so:
  
  ```
  {% if currentUser %}
      <a href="{{ entry.cpEditUrl }}">
          Edit
      </a>
  {% endif %}
  
  ```
  
  And also tried this:
  
  ```
  {% if entry.isEditable() %}
      <a href="{{ entry.cpEditUrl }}">
          Edit
      </a>
  {% endif %}
  
  ```
  
  Neither are working. Any ideas?
  
  **Tags:** templating, usermodel
  
  > **Comments:**
  > **username_1**: Is this in the context or a normal template request? i.e. you're not doing something edge case like trying to add this code inside of a redirect Twig tag or something similar?  
  > **username_0**: Normal template request. It was working fine the other day. I have looked through all my git commits, turned off plugins, etc and I cannot get it working again.  
  > **username_1**: Hate to ask the obvious, but you're positive you're logged in?  
  > **username_0**: Yes, absolutely positive.  
  > **username_1**: Did you happen to update Craft between the time it was working and now?  If so, do you remember the version you were on?  
  > **username_0**: I may have figured it out. I was logged in with non-www. But going to the front end with www. Is there a way to make Craft not care about www?  
  > **username_1**: You'd be better off picking either www or non-www as the canonical domain and forcing a rewrite from the other to that one: https://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way - better for SEO as well because Google will index both as 2 separate sites instead of 1.  
  > **username_1**: Be sure and add an official answer as well. ;)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-08-24. Score: 2
  
  Per username_1's request. I am answering my own question.
  
  I figured out that I was logging in via non-www, and accessing the site at www.
  
  So the official answer is to choose either www or non-www. I chose to remove the www from the URL.
  
  Here's my .htaccess for that, including allowing for fonts to be accessed cross domain, as I had issues with this as well.
  
  ```
  <IfModule mod_rewrite.c>
      RewriteEngine On
  
      # Remove www
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  </IfModule>
  
  <FilesMatch "\.(eot|ttf|otf|woff|svg)">
      Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
  
  ```
  
  **Note!!!** Once this is done, make sure to clear your Craft cache., especially if using fonts/font-icons.
  
  
  ---
  
  