You are here

function _privatemsg_block_menu in Privatemsg 6.2

Same name and namespace in other branches
  1. 6 privatemsg.module \_privatemsg_block_menu()
  2. 7.2 privatemsg.module \_privatemsg_block_menu()
  3. 7 privatemsg.module \_privatemsg_block_menu()
1 call to _privatemsg_block_menu()
privatemsg_block in ./privatemsg.module

File

./privatemsg.module, line 1511
Allows users to send private messages to other users.

Code

function _privatemsg_block_menu() {
  global $user;
  $block = array();
  $links = array();
  if (privatemsg_user_access('write privatemsg')) {
    $links[] = l(t('Write new message'), privatemsg_get_dynamic_url_prefix($user->uid) . '/new', array(
      'attributes' => array(
        'title' => t('Write new message'),
      ),
    ));
  }
  if (privatemsg_user_access('read privatemsg') || privatemsg_user_access('read all private messages')) {
    $links[] = l(privatemsg_title_callback(), privatemsg_get_dynamic_url_prefix($user->uid));
  }
  if (count($links)) {
    $block = array(
      'subject' => t('Private messages'),
      'content' => theme('item_list', $links),
    );
  }
  return $block;
}