Wrong implementation of hook_user()
kiamlaluno - January 17, 2009 - 14:19
| Project: | WeatherFacti -- from a weather.com xml feed |
| Version: | 6.x-1.9 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
The module has a wrong implementation of hook_user() which causes Drupal to not work when a user page is being viewed (and when a user tries to register).
The following code (taken by the module), doesn't do anything when $type is equal to 'form' that should be when the module must add its own fields in the user form.
<?php
function weatherfacti_user($type, &$edit, &$user, $category = NULL) {
switch ($type) {
case 'delete':
case 'update':
getGeoIP('', TRUE);
weatherfacti_cache_controler::delete_cache($user->uid);
break;
case 'validate':
if ($edit['weatherfacti_days'] == "0" || $edit["weatherfacti_days"] == "") {
form_set_error("weatherfacti_days", "Must be greater than zero.");
}
/*
if (!preg_match("/^[0-9]{5}\$/", $edit["weatherfacti_location"]))
form_set_error('weatherfacti_location', "Please enter a five digit postal code");
*/
break;
}
}
?>
#1
See the documentation for a more detailed description of
hook_user().