本文整理汇总了PHP中forum_get_email_message_id函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_get_email_message_id函数的具体用法?PHP forum_get_email_message_id怎么用?PHP forum_get_email_message_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_get_email_message_id函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_cron
//.........这里部分代码省略.........
continue;
}
}
// Make sure we're allowed to see it...
if (!forum_user_can_see_post($forum, $discussion, $post, NULL, $cm)) {
mtrace('user '.$userto->id. ' can not see '.$post->id);
continue;
}
// OK so we need to send the email.
// Does the user want this post in a digest? If so postpone it for now.
if ($userto->maildigest > 0) {
// This user wants the mails to be in digest form
$queue = new stdClass();
$queue->userid = $userto->id;
$queue->discussionid = $discussion->id;
$queue->postid = $post->id;
$queue->timemodified = $post->created;
$DB->insert_record('forum_queue', $queue);
continue;
}
// Prepare to actually send the post now, and build up the content
$cleanforumname = str_replace('"', "'", strip_tags(format_string($forum->name)));
$userfrom->customheaders = array ( // Headers to make emails easier to track
'Precedence: Bulk',
'List-Id: "'.$cleanforumname.'" <moodleforum'.$forum->id.'@'.$hostname.'>',
'List-Help: '.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id,
'Message-ID: '.forum_get_email_message_id($post->id, $userto->id, $hostname),
'X-Course-Id: '.$course->id,
'X-Course-Name: '.format_string($course->fullname, true)
);
if ($post->parent) { // This post is a reply, so add headers for threading (see MDL-22551)
$userfrom->customheaders[] = 'In-Reply-To: '.forum_get_email_message_id($post->parent, $userto->id, $hostname);
$userfrom->customheaders[] = 'References: '.forum_get_email_message_id($post->parent, $userto->id, $hostname);
}
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
$postsubject = html_to_text("$shortname: ".format_string($post->subject, true));
$posttext = forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto);
$posthtml = forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto);
// Send the post now!
mtrace('Sending ', '');
$eventdata = new stdClass();
$eventdata->component = 'mod_forum';
$eventdata->name = 'posts';
$eventdata->userfrom = $userfrom;
$eventdata->userto = $userto;
$eventdata->subject = $postsubject;
$eventdata->fullmessage = $posttext;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $posthtml;
$eventdata->notification = 1;
// If forum_replytouser is not set then send mail using the noreplyaddress.
if (empty($CFG->forum_replytouser)) {
示例2: forum_cron
//.........这里部分代码省略.........
}
// Make sure groups allow this user to see this email.
if ($discussion->groupid > 0 and $groupmode = groups_get_activity_groupmode($cm, $course)) {
// Groups are being used.
if (!groups_group_exists($discussion->groupid)) {
// Can't find group - be safe and don't this message.
continue;
}
if (!groups_is_member($discussion->groupid) and !has_capability('moodle/site:accessallgroups', $modcontext)) {
// Do not send posts from other groups when in SEPARATEGROUPS or VISIBLEGROUPS.
continue;
}
}
// Make sure we're allowed to see the post.
if (!forum_user_can_see_post($forum, $discussion, $post, null, $cm)) {
mtrace('User ' . $userto->id . ' can not see ' . $post->id . '. Not sending message.');
continue;
}
// OK so we need to send the email.
// Does the user want this post in a digest? If so postpone it for now.
$maildigest = forum_get_user_maildigest_bulk($digests, $userto, $forum->id);
if ($maildigest > 0) {
// This user wants the mails to be in digest form.
$queue = new stdClass();
$queue->userid = $userto->id;
$queue->discussionid = $discussion->id;
$queue->postid = $post->id;
$queue->timemodified = $post->created;
$DB->insert_record('forum_queue', $queue);
continue;
}
// Prepare to actually send the post now, and build up the content.
$cleanforumname = str_replace('"', "'", strip_tags(format_string($forum->name)));
$userfrom->customheaders = array('List-Id: "' . $cleanforumname . '" ' . generate_email_messageid('moodleforum' . $forum->id), 'List-Help: ' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id, 'Message-ID: ' . forum_get_email_message_id($post->id, $userto->id), 'X-Course-Id: ' . $course->id, 'X-Course-Name: ' . format_string($course->fullname, true), 'Precedence: Bulk', 'X-Auto-Response-Suppress: All', 'Auto-Submitted: auto-generated');
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
// Generate a reply-to address from using the Inbound Message handler.
$replyaddress = null;
if ($userto->canpost[$discussion->id] && array_key_exists($post->id, $messageinboundhandlers)) {
$messageinboundgenerator->set_data($post->id, $messageinboundhandlers[$post->id]);
$replyaddress = $messageinboundgenerator->generate($userto->id);
}
if (!isset($userto->canpost[$discussion->id])) {
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course, $modcontext);
} else {
$canreply = $userto->canpost[$discussion->id];
}
$data = new \mod_forum\output\forum_post_email($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $canreply);
$userfrom->customheaders[] = sprintf('List-Unsubscribe: <%s>', $data->get_unsubscribediscussionlink());
if (!isset($userto->viewfullnames[$forum->id])) {
$data->viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id);
} else {
$data->viewfullnames = $userto->viewfullnames[$forum->id];
}
// Not all of these variables are used in the default language
// string but are made available to support custom subjects.
$a = new stdClass();
$a->subject = $data->get_subject();
$a->forumname = $cleanforumname;
$a->sitefullname = format_string($site->fullname);
$a->siteshortname = format_string($site->shortname);
$a->courseidnumber = $data->get_courseidnumber();
$a->coursefullname = $data->get_coursefullname();
$a->courseshortname = $data->get_coursename();
$postsubject = html_to_text(get_string('postmailsubject', 'forum', $a), 0);
$rootid = forum_get_email_message_id($discussion->firstpost, $userto->id);
if ($post->parent) {