In privatemsg.api.php, the documentation mentions hook_privatemsg_message_delete.
This doesn't appear to exist anywhere (or be called anywhere).

It would be good to see this functionality (e.g. to integrate with activity module, and so track when a message is deleted).

As deleted messages can be restored, it would be good to also have an undelete hook: hook_privatemsg_message_undelete.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manarth’s picture

Status: Active » Needs review
FileSize
3.04 KB

The attached patch adds delete and undelete hooks, and adds additional documentation for both.

Status: Needs review » Needs work

The last submitted patch, 750566_add_delete_undelete_hooks.patch, failed testing.

Berdir’s picture

Version: 6.x-1.1 »

We decided to remove the hook because modules don't need to act when a message is deleted but when it is flushed and we forgot to update the documentation. But I can see that it could be of use.

However, I think this needs to be done against 2.x because new features are not allowed in 1.x.

Berdir’s picture

Status: Needs work » Needs review
Berdir’s picture

Title: hook_privatemsg_message_delete is documented but doesn't exist. » Add message delete changed hook and update thread_change_delete() to work like thread_change_status()
Status: Needs review » Needs work
Berdir’s picture

Version: » 6.x-2.x-dev
Status: Needs work » Needs review
FileSize
3.22 KB

Attaching a patch.

Berdir’s picture

FileSize
3.22 KB

Fixed a wrongly named variable in the patch. This passes all tests now locally, the test bot currently doesn't like Privatemsg so much.

Berdir’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Category: bug » feature
Status: Needs review » Patch (to be ported)

Commited.

Berdir’s picture

Status: Patch (to be ported) » Needs review
FileSize
4.01 KB

Attaching a patch for 7.x to run the tests on it..

Berdir’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

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