function privatemsg_undo_action in Privatemsg 6
Same name and namespace in other branches
- 6.2 privatemsg.pages.inc \privatemsg_undo_action()
- 7.2 privatemsg.pages.inc \privatemsg_undo_action()
- 7 privatemsg.pages.inc \privatemsg_undo_action()
Menu callback for messages/undo/action.
This function will test if an undo callback is stored in SESSION and execute it.
1 string reference to 'privatemsg_undo_action'
- privatemsg_menu in ./
privatemsg.module - Implements hook_menu().
File
- ./
privatemsg.module, line 2349 - Allows users to send private messages to other users.
Code
function privatemsg_undo_action() {
// Check if a undo callback for that user exists.
if (isset($_SESSION['privatemsg']['undo callback']) && is_array($_SESSION['privatemsg']['undo callback'])) {
$undo = $_SESSION['privatemsg']['undo callback'];
// If the defined undo callback exists, execute it
if (isset($undo['function']) && isset($undo['args'])) {
// Load the user object.
if (isset($undo['args']['account']) && $undo['args']['account'] > 0) {
$undo['args']['account'] = user_load((int) $undo['args']['account']);
}
call_user_func_array($undo['function'], $undo['args']);
}
// Return back to the site defined by the destination GET param.
drupal_goto();
}
}