Jump to content
Larry Ullman's Book Forums

Chapter 13 Login Error


Recommended Posts

Running into a nasty little bug in my login.php script (13.5).

 

Fatal error: Call to undefined function is_administrator().

 

It's as if the footer.html file can not locate the function which is located in the functions.php file inside the includes folder.

 

I'm sure it is "user error." I just wanted to check in and see if anyone else has experienced this nasty little bug.

Link to comment
Share on other sites

It's not a bug. You are not including/requiring the file where the function is located. This error is happening because the script can't find a function with the name of is_administrator().

 

To test this for yourself, try adding this right before where the function is called:

 

if ( ! function_exists('is_administrator') ) { function is_administrator() { echo __FUNCTION__. ' was undefined.'; } }

  • Upvote 2
Link to comment
Share on other sites

I looked at the script all seems to be fine, and considering this is the 4th edtion of the book it must be 100% correct. I saw that the header.html includes the functions.php script. So i would just check the include file paths, i think the path is incorrect that's why you are getting your error.

Link to comment
Share on other sites

It's not a bug. You are not including/requiring the file where the function is located. This error is happening because the script can't find a function with the name of is_administrator().

 

To test this for yourself, try adding this right before where the function is called:

 

if ( ! function_exists('is_administrator') ) { function is_administrator() { echo __FUNCTION__. ' is now undefined'; } }

 

That's a cool way to check if a function exists. When i came to answer the question no one had answered yet, but i checked through the book first to locate where the functions.php script was included. By the time i got to submit my post you beat me to it.

Link to comment
Share on other sites

You guys are awesome! The include file in header.html (Step #1, page 385) was missing. Making rookie mstakes is frustrating, but a terrific way to learn, none-the-less. I'm glad you guys have my back. Proceeding with the remainder of the chapter. I may return with more rookie questions. I've been very pleased I made it this far largely on my own. Kudos to Larry for a well-written, well-documented text.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...