本文整理汇总了PHP中c2cTools::getUsersToNotify方法的典型用法代码示例。如果您正苦于以下问题:PHP c2cTools::getUsersToNotify方法的具体用法?PHP c2cTools::getUsersToNotify怎么用?PHP c2cTools::getUsersToNotify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c2cTools
的用法示例。
在下文中一共展示了c2cTools::getUsersToNotify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
// If the posting user is logged in, increment his/her post count
if (!$pun_user['is_guest']) {
if ($pun_user['num_posts'] == 0) {
}
$low_prio = $db_type == 'mysql' ? 'LOW_PRIORITY ' : '';
$db->query('UPDATE ' . $low_prio . $db->prefix . 'users SET num_posts=num_posts+1, last_post=' . $now . ' WHERE id=' . $pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
// Redirect to "symfony app" after comment has been posted
if ($is_comment) {
$doc_param = get_doc_param($cur_posting['subject'] ? $cur_posting['subject'] : $subject);
// clear symfony cache for the corresponding docs view, diff, history.. - in order to have number of comments properly displayed)
c2cTools::clearCommentCache($doc_param[0], $doc_param[1]);
// if this is the first comment on an outing or an image, we should send notifications to concerned people
// and subscribe them to topic
if ($fid) {
$users = c2cTools::getUsersToNotify($doc_param[0]);
if (!empty($users)) {
// subscribe users to topic
$values = array();
foreach ($users as $user) {
$values[] = '(\'' . $user . "', '{$new_tid}')";
}
$db->query('INSERT INTO ' . $db->prefix . 'subscriptions (user_id, topic_id) VALUES ' . implode(', ', $values)) or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
// TODO maybe just continue silently if subscription fails?
// send mails to concerned users
require PUN_ROOT . 'include/email.php';
$result = $db->query('SELECT id, language, email FROM ' . $db->prefix . 'users WHERE id IN (' . implode(', ', $users) . ')') or error('Unable to fetch user languages', __FILE__, __LINE__, $db->error());
// TODO idem
if ($db->num_rows($result) != count($users)) {
message($lang_common['Bad request']);
}