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

Any way of trapping the error message from db_query?

I'm working on a module to "check out" and "check in" nodes, to get around the problem of multiple users updating the same node. A feature of this is that users can choose to "check out" the node so that it remains locked to other users even if they have finished editing it (that way they can come back to it later without fear of it being messed up).

The basic plan is this:
1) Create a new table "checkout" with uid/nid and timestamp. NID is a unique key (logically: more than one user cannot update a node at the same time)
2) Use nodeapi "validate": INSERT an entry into "checkout" with the nid and uid. If there is an error because the row already exists, then check to see if the associated uid is the same as current uid. If it is, then allow editing, if it is not then give an error message.

This all works ok, except that when the row exists I get an SQL error message across the top of the page. Since this is an accepted condition, I really want to trap that error message and use it in the code rather than have it display. It is possible to do this?

Why not do a SELECT first, you might ask?

Two reasons:
- I'm a bit uncertain about using START TRANSACTION and/or LOCK TABLES - afraid this would not fit in the Drupal DB abstraction layer.
- since most of the time people will only want to make sure nobody changes the node while they are actively editing it, then just

Tracker should allow to filter based on type

For example, now click on "My forum discussion" or "Active forum discussions" basically do the same as "recent posts". It does not taking into filter for FORUM topics ONLY.

Book Review

Ive been looking for a book-review module for drupal and found this. Which is for 4.4.0. It dosnt seem any bug reports have been answered in 4+ months. Someone posted a 4.5 update . Which fixed some stuff in the org one.

Im not sure if this is a bug (had it on both) but when Im an admin, I can't add content, it gives me this error:
warning: Invalid argument supplied for foreach() in

Taxonomy Menu (Site Menu) variation . . .

I like the upgrade, but I also liked Taxonomy Menu to either be fully expanded all the time, or its own block. How should I do this?

Ben

listhandler.module

I was just wondering if info about the forum, the nid and/or the sid will be added in the mail listhandler sends out the my mailinglist, and not just the content.

I need this so the users can use ONLY mail to make new nodes/reply to nodes. Now if they get mail with the content of a node, they can't reply from the mail, without checking on the forum for the nid number etc.

Parameters checking during settings saving.

Hello.

I have the settings section in my module

function mymodule_settings() {

  $output .= form_textfield(t('Path_to_some_file'), 'path_parameter', variable_get("path_parameter", ""), 42, 200, '.');

  return $output;
}

Where I can insert the function

Pages

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