Because of $form['#redirect'] is bad ??? ... Yet the Path looks correct, I do not understand :/

CommentFileSizeAuthor
#4 1682964-4.patch839 byteslokapujya
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tanmayk’s picture

$form['#redirect'] is not supported in D7, instead it should be $form_state['redirect'] in submit handler.
Please do have a look at Form API references for more details.
Here is the patch:

diff --git a/messaging_simple/messaging_simple.module b/messaging_simple/messaging_simple.module
index ebe1f03..337275b 100644
--- a/messaging_simple/messaging_simple.module
+++ b/messaging_simple/messaging_simple.module
@@ -138,7 +138,6 @@ function messaging_simple_view_form($form, &$form_state, $message) {
     '#type' => 'submit',
     '#value' => t('Delete'),
   );
-  $form['#redirect'] = 'user/' . $message->uid . '/messages';
 
   return $form;
 }
@@ -150,6 +149,8 @@ function messaging_simple_view_form_submit($form, &$form_state) {
   db_delete('messaging_simple')
     ->condition('mgid', $form_state['values']['message']->mgid)
     ->execute();
+  $user_id = $form_state['values']['message']->uid;
+  $form_state['redirect'] = 'user/' . $user_id . '/messages';
   drupal_set_message(t('The message has been deleted.'));
 }

Regards,
Tanmay

nibo’s picture

+1
The same problem here! Came up with the same patch as in #1. Works fine!

Just wondering, why the patch is not commited yet?

lokapujya’s picture

Issue summary: View changes
Status: Active » Needs review
lokapujya’s picture

FileSize
839 bytes

Re-rolled the pasted patch

lokapujya’s picture

duplicate.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community
Parent issue: » #2506795: Plan for Messaging v7.x-1.0 release

Good to go.

  • Nafes committed dfb67f6 on 7.x-1.x authored by tanmayk
    Issue #1682964 by lokapujya, tanmayk: "Delete message" don't work on...
Nafes’s picture

Status: Reviewed & tested by the community » Fixed

Fixed. Thanks to all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.