Errata (First Edition)
This page lists the errors found in the first edition of the book.
Chapter 6. Working with Users, Page 66
Sat, 06/09/2007 - 7:35am — soxofaanhook_user($op, &$edit, &$user, $category = NULL)
hook_user($op, &$edit, &$account, $category = NULL)
The given signature of the hook_user() function uses argument name $user, while http://api.drupal.org/api/5/function/hook_user uses $account, which leads to less confusion with the global $user variable of the currently logged in user. This could also eliminate the caution paragraph on page 67. On further pages (e.g. in first code block on page 68, legalagree_user() function on page 69) $user is also used, while $account could be safer. Sidenote: on page 73 in function loginhistory_user() $account is used like suggested.
Chapter 6. Working with Users, Page 66
Mon, 07/09/2007 - 1:29pm — ChucklThis heading and subsequent text is inaccurate and misleading.
Change the heading and explanatory text to
Testing If a User is an Anonymous or Authenticated User
If $user->uid is 0 it indicates an anonymous user; if it is not 0 then it indicates an authenticated or registered user. An authenticated user will be given a uid which is the primary key into the users table. I cannot find any field that will provide accurate information on whether a user is currently logged on or not. The user->login field will have a timestamp but that only indicates the time of last login, not the current logged in state.
[You are thinking about this too hard. During a request, the global $user variable will have uid->0 if the current user is anonymous (i.e., not logged in). That's all we're testing. I probably should have stated that the test is during the request. -JV]
Chapter 6. Working with Users, Page 68
Sun, 06/17/2007 - 10:19pm — rcharneyfunction hide_profile_alter(&$account, &$fields) {
function blog_profile_alter(&$account, &$fields) {
Change hide_profile_alter to blog_profile_alter. Since we are nominally working with the blog module, the hook_profile_alter() should reflect this.
[No! By implication we are working with the hide.module. We do not tromp on core module namespaces. -JV]
Chapter 6. Working with Users, Page 70
Mon, 04/23/2007 - 2:28pm — jvandyk...smash your belongs with a ball-peen hammer
...smash your belongings with a ball-peen hammer
Typo.
Chapter 7. Working with Nodes, Page 86
Thu, 05/15/2008 - 9:51am — brad_mn1988I do not know enough to determine whether it is an error. But you tell us to refer to Chapter 2 for "more information on creating .install files" where on pg. 11 you tell us that custom modules reside in the "sites/all/modules" subdirectory, however on pg. 86 you say to put the joke module in the "sites/all/modules/custom" directory. I do not know if one is an error and the other is not or if there is some basis for putting joke inside "custom" and leaving "annotate" one level above. Is this something to do with implementing a node, is it an alternative?
Again, the author must use his expertise to decide: If it is an error I would imagine that you either use the custom directory both places or you don't use the custom directory both places, or the author can include a sentence or two explaining the decision to do it differently on the two pages.
It is an unexplained inconsistency in directions for creating a module that *may* be an error.
Chapter 7. Working with Nodes, Page 86
Mon, 04/23/2007 - 2:31pm — jvandykStart by creating a folder a named
Start by creating a folder named
Typo.
Chapter 7. Working with Nodes, Page 87
Sun, 06/24/2007 - 10:58am — soxofaannid int unsigned ...
vid int unsigned ...
nid int_unsigned ...
vid int_unsigned ...
I'm not familiar with pgsql, but in all .install files i've looked into i've only found "int_unsigned" as pgsql counterpart of the mysql "int unsigned" definitions.
Chapter 7. Working with Nodes, Page 93
Tue, 08/28/2007 - 7:49pm — munrockThis hook is only called for the current node type. For example, if the node type is joke, then joke_insert() would be called. If a new node of type book were added, joke_insert() would not be called (book_insert() would be called instead).
This hook is only called for the current module type. ...
The information in this para is misleading, because it's ambiguous in its distinction between node and module namespaces. For example if a new node of type book were added to the joke module, joke_insert() would be called for the book node type.
Chapter 7. Working with Nodes, Page 97
Thu, 05/03/2007 - 11:57pm — tjrThe markup doesn't validate:
- There is an extra closing </legend> tag.
- check_markup() shouldn't be used in a label element. (A paragraph element is not valid here).
- Remove the stray </legend> tag.
- Change "check_markup($node->punchline)" to "$node->punchline".
Invalid XHTML.
Chapter 7. Working with Nodes, Page 104
Sun, 04/29/2007 - 5:52am — dshawAt the top left, the path from the diamond containing "user allowed to access this input format?" to the rectangle containing "Disallowed" is not labelled.
Add a label of "No" to this path.
Small omission.
