You are here

function _shoutbox_is_user_owned in Shoutbox 7.2

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

Determine if the current user owns the $shout.

Parameters

$shout: The shout object that we want to check.

Return value

True if the shout is owned by the current user.

2 calls to _shoutbox_is_user_owned()
shoutbox_display_posts in ./shoutbox.module
Output existing shoutbox posts as html.
_shoutbox_user_access in ./shoutbox.module
This function is necessary because even if a user has permission (according to the user_access function), they still should not have some permissions, such as moderating their own posts, etc.

File

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

Code

function _shoutbox_is_user_owned($shout) {
  global $user;
  $user_owned = FALSE;
  if ($shout->uid > 0 && $shout->uid == $user->uid) {
    $user_owned = TRUE;
  }
  elseif ($shout->uid == 0 && $user->uid == 0) {
    if ($shout->sid == session_id()) {
      $user_owned = TRUE;
    }
    elseif (empty($shout->sid) && !empty($shout->hostname)) {
      $user_owned = $shout->hostname == ip_address();
    }
  }
  return $user_owned;
}