This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Implementation of _user chokes on 'insert' - probably really simple error

Hi

I have implemented _user for my module to ask users a specific question and store the result in my own table. My form question shows up perfectly (I think - it looks correct anyway). My code chokes when I actually do the
registration and submit. It breaks on the database insert in the user module (not mine) but my insert must be
the problem. Here is my little _user:

function fhsstadmin_user($op, &$edit, &$user, $category = NULL)
{
  $books = _findbooks();  // return list of books 
  switch($op)
 {
    case 'register':
      $form['fhsstadmin-initialbook'] = array(
      '#type' => 'radios',
      '#title' => t('Choose the book you would like to start with:'),
      '#options' => $books);
   break;
   case 'insert':
     db_query("INSERT INTO fhsstadmin_userbooks (uid, bookparentid) VALUES (%d, %d)",$user->uid,$edit['fhsstadmin-initialbook']);
     $edit['fhsstadmin-initialbook'] = NULL;
   break;
 } // end switch
return $form;
}

I would really appreciate any advice. Its probably a trivial issue for an expert but I really can't see whats wrong and I think I've followed what is defined on: http://drupaldocs.org/api/head/function/hook_user

I have added the error message for completeness:

user error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0, pass, init, status, created, uid) VALUES ('fred', 'marknewlyn query: INSERT INTO users (name, mail, 0, pass, init, status, created, uid) VALUES ('fred', 'marknewlyn@gmail.com', '37693cfc748049e45d87b8c7d8b9aacd', '364aacd64f75ca82e0c373bc40500c6c', 'marknewlyn@gmail.com', '1', '1133714662', '13') in /var/www/fhsstadmin/includes/database.mysql.inc on line 108.

Taxonomy Access Control

Hi, just went to add the Taxonomy Access Control module and the README says to 'patch -p0 < taxonomy.patch'

So I ran it like this in /drupal/modules... patch -p0 < taxonomy_access/taxonomy.patch

and get these errors after typing in taxonomy.module for the file...

I get too many errors from privatemsg module

this was the first
Unknown column 'newmsg' in 'where clause' query: SELECT COUNT(*) FROM privatemsg WHERE recipient = '1' AND newmsg = 1 AND recipient_del = 0 in /home/neubern/public_html/includes/database.mysql.inc on line 66.

then i tried to modify every word NEWMSG to NEW as i found in one topic here in drupal, then i get this error:
Unknown column 'recipient_del' in 'where clause' query: SELECT COUNT(*) FROM privatemsg WHERE recipient = '1' AND new = 1 AND recipient_del = 0 in /home/neubern/public_html/includes/database.mysql.inc on line 66.

Browse files with file manager

I'm looking for a module that will enable users to browse already existing images and files in /files and attach/link directly from the node, and click on the file to automatically link the file to the node. This should function as img_assist is supposed to function, but for files like .pdf and .odt instead of images only.

user list by permission

I needed to return a list of users who have access to a specific permission.

For example suppose you wanted a list of users who have permission to "post comments" in the comment module. This permission is typically enabled for multiple roles.

The following function will provide such a list. It could easily be expanded to support a dynamic number of permissions, but this suits my purpose for now.

Perhaps someone will find this useful.

URL Alias not working in one of my modules

I have programmed two modules recently.

They both have links to nodes as part of the menus.

They both refer to the nodes in the following way:

l($goto->title, "/node/$goto->nid");

In an instance where both modules refer to the same node, only one of them is linking to the URLALIAS (in this case, it is "/garage/89_civic") and the other links to "/node/231."

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions