function privatemsg_filter_form_submit in Privatemsg 6
Same name and namespace in other branches
- 6.2 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_form_submit()
- 7.2 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_form_submit()
- 7 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_form_submit()
1 string reference to 'privatemsg_filter_form_submit'
- privatemsg_filter_form in privatemsg_filter/
privatemsg_filter.module - Form to show and allow modification of tagging information of a conversation.
File
- privatemsg_filter/
privatemsg_filter.module, line 718 - Allows users to tag private messages and to filter based upon those tags.
Code
function privatemsg_filter_form_submit($form, &$form_state) {
if (isset($form_state['values']['submit'])) {
$tags = explode(',', $form_state['values']['tags']);
// Step 1 - Delete all tag mapping. I cannot think of a better way to remove tags that are no longer in the textfield, so ideas welcome.
privatemsg_filter_remove_tags($form_state['values']['thread_id']);
// Step 2 - Get the id for each of the tags.
$tag_ids = privatemsg_filter_create_tags($tags);
// Step 3 - Save all the tagging data.
foreach ($tag_ids as $tag_id) {
privatemsg_filter_add_tags($form_state['values']['thread_id'], $tag_id);
}
drupal_set_message(t('Tagging information has been saved.'));
}
}