Errata (Second Edition)
This page lists the errors found in the book. Help us improve this book by logging in and submitting any errors you find. In cases where errors exist in the code, they are corrected immediately in the code repository.
Chapter 2. Writing a Module, Page 18
Sun, 09/07/2008 - 8:40pm — mikewhobikesvariable_get('annotate_node_types', array('story'))
variable_get('annotate_node_types', array('page'))
Default value shown is not consistent with the module's (see last line on page 19).
Chapter 2. Writing a Module, Page 19
Sun, 09/07/2008 - 8:31pm — mikewhobikesAdminister > Settings > Annotate
Administer > Site Configuration > Annotate
Menu label is incorrect.
Chapter 2. Writing a Module, Page 19
Sun, 09/07/2008 - 8:42pm — mikewhobikes'annotate_nodetypes'
'annotate_node_types'
Variable is given a different name than in previous and following examples.
Chapter 2. Writing a Module, Page 23
Thu, 08/28/2008 - 9:08am — bellebriusvariable_delete('annotate_node_types');
variable_del('annotate_node_types');
Function name is incorrect.
Chapter 2. Writing a Module, Page 23
Sun, 08/31/2008 - 11:25am — chrissearleCREATE TABLE annotate (
uid int(10) NOT NULL,
nid int(10) NOT NULL,
note longtext NOT NULL,
when int(11) NOT NULL default '0',
PRIMARY KEY (uid, nid),
);
CREATE TABLE annotations (
uid int(11) NOT NULL,
nid int(11) NOT NULL,
note longtext NOT NULL,
created int(11) NOT NULL default 0,
PRIMARY KEY (uid, nid)
)
I know that the SQL is "something like" - but - having pasted it in and used schema module to cut'n'paste the code it would be better if it actually was valid SQL and matched the schema that was used.
There are two points that don't match
1) table name ("annotate" vs. "annotations")
2) column "when" is really column "created" (and "when" is a MySQL reserved word so would need quoting)
Plus - one error (at least for MySQL) - an extra comma after the PRIMARY KEY column.
Chapter 2. Writing a Module, Page 23
Sun, 09/07/2008 - 11:32pm — mikewhobikesIn the downloadable code, hook_install() is missing the line to delete the module's variable.
Update online code to include:
variable_del('annotate_node_types')
Omission from online code.
Chapter 2. Writing a Module, Page 30
Sat, 09/13/2008 - 9:46pm — mikewhobikesAfter creating new variables ('annotate_limit_per_node' and 'annotate_deletion') the .install file should be updated to delete those variables on uninstall.
Either instructions on what to add to annotate.install or just a brief note to remind the reader to do so would be helpful.
Chapter 3. Hooks, Actions, and Triggers, Page 36
Mon, 09/29/2008 - 7:33pm — ericxfunction hook_nodeapi(&$node, $op, $a3=NULL, $a4=NULL) {
function beep_nodeapi(&$node, $op, $a3=NULL, $a4=NULL) {
The function name should be "beep_nodeapi" rather than "hook_nodeapi". The hook itself is named hook_nodeapi(). The hooked version for the module needs to be name [module name]_nodeapi().
Chapter 3. Hooks, Actions, and Triggers, Page 41
Wed, 09/10/2008 - 7:59pm — mikewhobikesIf you've done everything correctly, your action should be available
If you've done everything correctly and enabled the Beep module, your action should be available
Minor suggestion: a reminder to enable the Beep module would be helpful.
Chapter 3. Hooks, Actions, and Triggers, Page 48
Wed, 11/05/2008 - 6:14pm — jvandykarray_merge($info['user_block_user_action']['hooks']['comment'], array('insert'));
array_unique(array_merge($info['user_block_user_action']['hooks']['comment'], array('insert')));
array_merge() appends values instead of combining them when keys are numeric, as they are implicitly in the above array.
