I know that a similar question has been asked before but the problem 开发者_Python百科that it doesn't have a complete answer for my question In drupal how to add name textfield to simple news block
function mymodule_simplenews_block_form_submit($form, &$form_state) {
if ($form['#id'] == 5) {
$name = $form_state['values']['name'];
// Do something here to store the name in the database
// ...
// ...
}
}
I don't get the part which has to do with "Do something here to store the name in the database" . First, Should I add the name field to the simplenews_subscribers table ? How can I save the name field in the database ? I know that there is a simplenews_realname module but it is for Drupal 6.
Thanks!
You shouldn't add a field to an existing table in another module as this will likely break things when the time comes to upgrade. Instead create your own table in a custom module using hook_schema and save the data there.
This module developer's guide will help if you're new to building Drupal modules.
精彩评论