function pm_block_user_block_submit in Privatemsg 7
Same name and namespace in other branches
- 6.2 pm_block_user/pm_block_user.pages.inc \pm_block_user_block_submit()
- 7.2 pm_block_user/pm_block_user.pages.inc \pm_block_user_block_submit()
Submit callback for block user form.
1 string reference to 'pm_block_user_block_submit'
- pm_block_user_list in pm_block_user/
pm_block_user.pages.inc - Formbuilder function to build a simple form to block users.
File
- pm_block_user/
pm_block_user.pages.inc, line 187 - User menu callbacks for pm_block_user.module.
Code
function pm_block_user_block_submit($form, &$form_state) {
global $user;
$insert = db_insert('pm_block_user')
->fields(array(
'author',
'recipient',
));
foreach ($form_state['valid_accounts'] as $account) {
$insert
->values(array(
'author' => $account->uid,
'recipient' => $user->uid,
));
drupal_set_message(t('!author has been blocked from sending you any further messages.', array(
'!author' => theme('username', array(
'account' => $account,
)),
)));
}
$insert
->execute();
}