Errata (First Edition)
This page lists the errors found in the first edition of the book.
Chapter 2. Writing a Module, Page 15
Fri, 06/15/2007 - 3:54pm — typo24Now navigating to Administer>Settings>Annotate
Now navigating to Administer>Site Configuration>Annotation Settings
The navigation titles given are slightly off. I saw that the first typo (Site configuration) was caught earlier, but my site is also giving Annotate a different name; annotation settings.
Chapter 2. Writing a Module, Page 18
Fri, 06/15/2007 - 4:23pm — typo24The data form (as shown in figure 2-2) does not appear
see description
I know it may seem insignificant or blatantly obvious to some, but I think mentioning that the "page" and "story" check boxes as shown in figure 2-1 (pg.15) should be checked to make the data form appear would be helpful. I am a first time user of Drupal and the fact that my data table wasn't showing up had me perplexed (and triple checking my code against the book's) for a while. Part of the problem is I am working with a site a coworker (who is no longer available to talk to) made and they only have "story" content created on the site.
Chapter 2. Writing a Module, Page 19
Mon, 04/30/2007 - 3:41pm — jvandykCREATE TABLE annotations
CREATE TABLE {annotations}
The curly brackets necessary for Drupal's automatic table prefixing were omitted.
Chapter 2. Writing a Module, Page 19
Fri, 06/22/2007 - 1:23pm — David GillaspeyThis appears twice in code block (once for mySQL version, once for pgsql version):
db_query("CREATE TABLE annotations (
Users inputting their own code from the book should add brackets, as was previously reported by another poster. Authors should update the downloadable code.
As mentioned, another poster previously reported that the brackets were missing in the book.
I'm reporting that this error still exists in the downloadable code for the chapter. (I don't know about the code for the whole book; I only downloaded the code for Chapter 2.)
Chapter 2. Writing a Module, Page 20
Thu, 05/03/2007 - 12:02am — mparedb_query("DELETE FROM {annotations} WHERE uid = %d and nid = %d", $user->uid, $nid);
db_query("DELETE FROM {annotations} WHERE uid = %d AND nid = %d", $user->uid, $nid);
AND not capitalized.
Chapter 2. Writing a Module, Page 21
Sun, 03/16/2008 - 5:19pm — KleDB is wasted too if a user is beeng deleted so you have also to catch an user-delete (please read first the following post from dshaw).
The following code does the job:
/**
* After Deleting User we have to delete all his annotations too
*/
function annotate_user($op,&$edit,&$user,$category=NULL) {
switch ($op) {
case 'delete':
db_query("DELETE FROM {annotations} WHERE uid = %d", $user->uid);
break;
}
}
And here are some additional lines to complete the annotate_nodeapi with a "delete"-functionality (see post from dshaw):
function annotate_nodeapi(&$node,$op,$teaser,$page) {
global $user; //move this to top
...
break; //don't forget this break !
case 'delete':
// delete annotations from all Users of this node
db_query("DELETE FROM {annotations} WHERE nid = %d", $node->nid);
break;
}
}
Omission
Chapter 2. Writing a Module, Page 21
Sun, 04/29/2007 - 5:41am — dshawIf a node is deleted its annotation is not, leading to wasted space in the DB. Deletion is a key feature, so even though this is an introductory chapter on writing a module I think it should be included. This feature is dealt with fully in Chapter 7, so the treatment in Chapter 2 could be brief and refer to Chapter 7 for more info.
A short section on deleting the annotation for a node when a node is deleted.
Omission
Chapter 3. Module-Specific Settings, Page 26
Fri, 06/22/2007 - 4:05pm — zensane'#default_value' => variable_get('annotate_deletion', 0) // default to Never
'#default_value' => variable_get('annotate_deletion', 0), // default to Never
To adhere to Drupal coding standards, the last array element should be followed by a comma.
[That's true throughout the book. See my post here.]
Chapter 3. Module-Specific Settings, Page 26
Fri, 06/22/2007 - 4:26pm — zensanet('After 30 days')
t('After 30 days'),
To adhere to Drupal coding standards, the last array element should be followed by a comma.
[That's true throughout the book. See my post here.]
Chapter 3. Module-Specific Settings, Page 27
Fri, 06/22/2007 - 4:08pm — zensane'#size' => 3
'#size' => 3,
To adhere to Drupal coding standards, the last array element should be followed by a comma.
[That's true throughout the book. See my post here.]
