You are here

function _shoutbox_get_links in Shoutbox 5

Same name and namespace in other branches
  1. 6.2 shoutbox.module \_shoutbox_get_links()
  2. 6 shoutbox.module \_shoutbox_get_links()
  3. 7.2 shoutbox.module \_shoutbox_get_links()
  4. 7 shoutbox.module \_shoutbox_get_links()

Returns an array containing the possible actions for the current user based on permissions and shout. The actions are edit, delete, moderate.

Parameters

shout: The shout for which we are testing permissions.

Return value

Array of themed actions.

2 calls to _shoutbox_get_links()
shoutbox_add_form_submit in ./shoutbox.module
Handles submission of a shout.
_shoutbox_display_posts in ./shoutbox.module
Output existing shoutbox posts as html. Used by shoutbox_block_view.

File

./shoutbox.module, line 978
shoutbox module displays a block for users to create short messages for thw whole site. Uses AHAH to update the database and display content.

Code

function _shoutbox_get_links($shout) {
  $links = theme('shoutbox_links');

  // Get array of links.
  if (_shoutbox_user_access('edit own shouts', $shout)) {
    $shoutlinks[] = $links['edit'];
  }
  if (_shoutbox_user_access('delete own shouts', $shout)) {
    $shoutlinks[] = $links['delete'];
  }
  if (_shoutbox_user_access('moderate shoutbox', $shout)) {
    if ($shout->moderate == 0) {
      $shoutlinks[] = $links['unpublish'];
    }
    else {
      $shoutlinks[] = $links['publish'];
    }
  }
  return $shoutlinks;
}