if (isloggedin() && $comment->owner != $object_owner) { delete_records('watchlist', 'object_id', $comment->object_id, 'object_type', $comment->object_type, 'owner', $comment->owner); $wl = new StdClass(); $wl->owner = $comment->owner; $wl->object_id = $comment->object_id; $wl->object_type = $comment->object_type; insert_record('watchlist', $wl); } // Message comment if applicable if ($comment->owner != $object_owner) { $object_title = get_title($comment->object_id, $comment->object_type); $message = __gettext(sprintf("You have received a comment from %s on '%s'. It reads as follows:", $comment->postedname, stripslashes($object_title))); $message .= "\n\n" . stripslashes($comment->body) . "\n\n"; $message .= __gettext(sprintf("To reply and see other comments, click here: %s", $redirect_url)); $message = wordwrap($message); message_user($object_owner, $comment->owner, stripslashes($object_title), $message); } } } } else { $messages[] = __gettext("Your comment could not be posted. The system thought it was spam."); } // If river plugin installed then note comment if (function_exists('river_save_event')) { $commenturl = $CFG->wwwroot . "mod/generic_comments/comment_page.php?object_id={$comment->object_id}&object_type={$comment->object_type}&comment_sort=ASC"; $username = "******"" . river_get_userurl($comment->owner) . "\">" . user_info("username", $comment->owner) . "</a>"; if (!isset($comment->owner)) { $comment->owner = -1; $username = __gettext("Anonymous user"); } river_save_event($comment->owner, $comment->object_id, $comment->owner, $comment->object_type, $username . " <a href=\"{$commenturl}\">" . __gettext("commented on") . "</a> " . river_get_friendly_id($comment->object_type, $comment->object_id));
/** * Send a notification to a user * * Could be a notifications or email, * depending on a user's preferences * * @param integer $user_id the user id * @param string $title the message title * @param string $message the message body * @return boolean * @todo TODO fix return type * @author Ben WerdMuller <*****@*****.**> */ function notify_user($user_id, $title, $message) { message_user($user_id, -1, $title, $message); }
// gettext variable // If we're logged on and not the owner of this post, add post to our watchlist if (logged_on && $comment->owner != $post->owner) { delete_records('weblog_watchlist', 'weblog_post', $comment->post_id, 'owner', $comment->owner); $wl = new StdClass(); $wl->owner = $comment->owner; $wl->weblog_post = $comment->post_id; insert_record('weblog_watchlist', $wl); } // Email comment if applicable if ($comment->owner != $post->owner) { $message = sprintf(__gettext("You have received a comment from %s on your blog post '%s'. It reads as follows:"), $comment->postedname, stripslashes($post->title)); $message .= "\n\n" . stripslashes($comment->body) . "\n\n"; $message .= sprintf(__gettext("To reply and see other comments on this blog post, click here: %s"), $CFG->wwwroot . user_info("username", $post->weblog) . "/weblog/" . $post->ident . ".html"); $message = wordwrap($message); message_user($post->owner, $comment->owner, stripslashes($post->title), $message); } // If river plugin installed then note comment if (function_exists('river_save_event')) { $un = user_info("username", $comment->owner); $commenturl = $CFG->wwwroot . "{$un}/weblog/{$comment->post_id}.html#cmt{$comment->ident}"; $username = "******"" . river_get_userurl($comment->owner) . "\">{$un}</a>"; if (!isset($comment->owner)) { $comment->owner = -1; $username = __gettext("Anonymous user"); } river_save_event($post->owner, $comment->ident, $comment->owner, "weblog_post::post", $username . " <a href=\"{$commenturl}\">" . __gettext("commented on") . "</a> " . river_get_friendly_id("weblog_post::post", $comment->post_id)); } } } } else {