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

Validating settings before they get saved

I need an extra password widget in a module, and have run into a snag.

I've implemented hook_settings. The behavior I want is to check if the password and the confirm password fields don't match, I want the usual sort of "Passwords Must Match" error message to appear.

The problem is that system.module saves my password settings very early in the request processing. I can't use hook_validate because it won't get called for the _settings page. I can't do the validation in hook_settings because the system steps in long before that.

What's the recommended way to deal with this. I have a solution that works, but it's so fragile that it's pretty much guaranteed to get broken the next time system.module changes:

if(isset($_POST['edit']['my_password'])){
//looks like we are setting the site password.
//make sure the copies match so we do not get locked out.
$pw = $_POST['edit']['my_password'];
$pw_confirm = $_POST['edit']['my_password_confirm'];
if($pw != $pw_confirm){
form_set_error('my_password', t('Passwords must match!'));
//and we must unset some globals to fool the systems settings
//gremlin. TO DO: This is hinkey, and may break.
unset($_POST['edit']['my_password']);
unset($_POST['edit']['my_password_confirm']);
if($_POST['op'] == t('Save configuration')){
$_POST['op'] .= "--mod"; //to fool system.module

Whiteboard like module

i've been looking for quite some time for a whiteboard module (for any cms), but have had no luck. does anyone know of one? or where to begin to develop one?

Chatbox langue problems

When i rewrite the module so the langue will fit.. All Swedish Å Ä Ö turns to sick characthers like boxes and stuff, Like this �. How do i solve this

And i rewrote a .po file that was included to, but i how do i add the .po file to chatbox?

/Coral

Chatbox problems

I have installed Chatbox by installing the tabels into my Mysql database and installed the module.. But where do the chatbox appear to users and how do i get it appear to users?

Module Template? - i.e. what hooks have to be called

I'm writing a module and when it's in the module directory nothing will display on the drupal site. None of the code is being executed. So it would help to know what hooks have to be called in Drupal 4.6.1. If a module template exists that all modules could start from that would be helpful too.

Image.module, large directories, and me

I did a couple of searches, but I didn't find anything related to using the filemanager module with image.module.

I llike a lot of the features the image.module provides, and I would like to use image.module to store my images instead of creating my own implementation of image.module just to get around having the module store everything in the same directory.

Pages

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