function theme_shoutbox_post in Shoutbox 6
Same name and namespace in other branches
- 5 shoutbox.module \theme_shoutbox_post()
- 6.2 shoutbox.theme.inc \theme_shoutbox_post()
- 7.2 shoutbox.theme.inc \theme_shoutbox_post()
- 7 shoutbox.theme.inc \theme_shoutbox_post()
Theme function for shoutbox posts.
Parameters
shout: The shout to be themed.
links: Links of possible actions that can be performed on this shout by the current user.
$alter_row_color: Whether or not to alternate the row color for posts. Should be set to FALSE for the page view.
5 theme calls to theme_shoutbox_post()
- shoutbox_add_form_submit in ./
shoutbox.module - Handles submission of a shout. Handles both ajax submission and regular form submission.
- theme_shoutbox_delete_form in ./
shoutbox.pages.inc - Function to handle deleting of shouts.
- theme_shoutbox_publish_form in ./
shoutbox.pages.inc - Display a confirmation page for publsihing a moderated shout.
- theme_shoutbox_unpublish_form in ./
shoutbox.pages.inc - Function to handle moderation of shouts.
- _shoutbox_display_posts in ./
shoutbox.module - Output existing shoutbox posts as html. Used by shoutbox_get_view.
File
- ./
shoutbox.module, line 282 - 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 theme_shoutbox_post($shout, $links = array(), $alter_row_color = TRUE) {
// Get the registered username of the person who posted the shout.
if ($shout->uid > 0) {
$user = user_load(array(
"uid" => $shout->uid,
));
$shout->username = $user->name;
}
else {
$shout->username = 'an anonymous user';
}
// BUGBUG strstr returns from http:// till end
// we should use that instead of full url.
if (strstr($shout->url, "http://")) {
$shout->url = '<a href="' . $shout->url . '" target="_blank">' . $shout->nick . '</a>';
}
else {
$shout->url = $shout->nick;
}
if ($links) {
foreach ($links as $link) {
$linkattributes = $link['attributes'];
$link_html = $link['title'];
$link_url = 'shoutbox/' . $shout->shout_id . '/' . $link['action'];
$action_links = l($link_html, $link_url, array(
'html' => TRUE,
'attributes' => $linkattributes,
)) . $action_links;
}
}
$title = 'Posted ' . format_date($shout->created, 'custom', 'm/d/y') . ' at ' . format_date($shout->created, 'custom', 'h:ia') . ' by ' . $shout->username;
$shout_classes = "shoutbox-msg ";
if ($alter_row_color) {
$shout_classes .= $shout->color ? "shoutbox-odd " : "shoutbox-even ";
}
if ($shout->moderate == 1) {
$shout_classes .= "shoutbox-unpublished ";
$shout->shout .= t("(This shout is waiting for approval by a moderator.)");
}
return "<div class=\" {$shout_classes} \" title=\"{$title}\"><span class=\"actions\">{$action_links}</span> <span class=\"shout\"><b>{$shout->url}</b>: {$shout->shout}</span></div>\n";
}