function weather_custom_block_delete_confirm_submit in Weather 6.5
Same name and namespace in other branches
- 5.6 weather.module \weather_custom_block_delete_confirm_submit()
Handle the deletion of a location
File
- ./
weather.module, line 1039 - Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world
Code
function weather_custom_block_delete_confirm_submit($form, &$form_state) {
// delete the entry
$sql = "DELETE FROM {weather_config} WHERE uid=%d AND cid=%d";
db_query($sql, $form_state['values']['uid'], $form_state['values']['cid']);
drupal_set_message(t('The location has been deleted.'));
if ($form_state['values']['uid'] < 0) {
// go back to the administration of system-wide weather blocks
$form_state['redirect'] = 'admin/settings/weather';
/** TODO
* Rehashing is not needed on every submission, only if the block
* is totally empty. On the other hand, this happens only
* rarely and surely is not a performance bottleneck.
*/
_block_rehash();
}
else {
$form_state['redirect'] = 'user/' . $form_state['values']['uid'] . '/weather';
}
}