function _shoutbox_is_user_owned in Shoutbox 6
Same name and namespace in other branches
- 5 shoutbox.module \_shoutbox_is_user_owned()
- 6.2 shoutbox.module \_shoutbox_is_user_owned()
- 7.2 shoutbox.module \_shoutbox_is_user_owned()
- 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. Used by shoutbox_get_view.
- _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 1090 - 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_is_user_owned($shout) {
global $user;
$user_owned = FALSE;
if ($shout->uid > 0 && $shout->uid == $user->uid) {
$user_owned = TRUE;
}
else {
if ($shout->uid == 0 && $user->uid == 0) {
if ($shout->sid == session_id()) {
$user_owned = TRUE;
}
else {
if (empty($shout->sid) && !empty($shout->hostname)) {
$user_owned = $shout->hostname == ip_address();
}
}
}
}
return $user_owned;
}