diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-11-09 14:23:04 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-11-09 14:23:04 -0200 |
commit | 61c12bd9539cd0d74f43bc74414f79609621b397 (patch) | |
tree | c95cf6f5815378985fb52d1dc64eb24f86ec60b2 /muamba.module | |
parent | 79a1634a5b5a2b14d0d487a8d5d4a9d305aba6ce (diff) | |
download | muamba-61c12bd9539cd0d74f43bc74414f79609621b397.tar.gz muamba-61c12bd9539cd0d74f43bc74414f79609621b397.tar.bz2 |
Showing muamba widget at muamba_privatemsg_view_alter()
Diffstat (limited to 'muamba.module')
-rw-r--r-- | muamba.module | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/muamba.module b/muamba.module index 3aa94bc..b03dea8 100644 --- a/muamba.module +++ b/muamba.module @@ -249,12 +249,27 @@ function muamba_block_view($delta = '') { /** * Implements hook_privatemsg_view_alter() - * - * @todo */ function muamba_privatemsg_view_alter(&$content) { - $bar = 'TODO: Add here request management bar.'; - $content['participants']['#markup'] = $bar . $content['participants']['#markup']; + $thread = $content['#thread']['thread_id']; + $transaction = muamba_get_transaction($thread, 'thread_id'); + + if (!empty($transaction)) { + global $user; + + $node = node_load($transaction['nid']); + $available = muamba_check_availability($node->nid); + $widget = ($node->uid == $user->uid) ? 'owner' : 'requester'; + + $bar = theme('muamba_widget_'. $widget, array( + 'node' => $node, + 'transaction' => $transaction, + 'available' => $available, + 'size' => 'big', + )); + + $content['participants']['#markup'] = $bar . $content['participants']['#markup']; + } } /** |