0

I turned on debug mode and see the following in my header:

Notice: Use of undefined constant - assumed ' '

I'm using the following function in header.php:

<?php if ( is_user_logged_in() ) {  
    global $current_user;
    get_currentuserinfo();
    echo $current_user->display_name; //affected line
} else {
...
}?>
  • I don't get that error, and I don't know why that particular code would cause it. – s_ha_dum Dec 1 '13 at 15:53
  • sounds like your currently logged in user doesn't have a display name set; did you check what it's set to under the admin dashboard -> users or in the database? – user16081 Dec 1 '13 at 18:50
  • The fields are properly filled and saved in admin, the error shows up even if user_email, user_login, user_firstname etc... is echoed. BTW, it works fine, I'm just curious why the debug throws this error. – elbatron Dec 1 '13 at 19:15
  • Since the constant is empty '' I wonder if you have an unprintable character on the line. – Charles Clarkson Dec 1 '13 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.