[外掛] 新文章群組通知 GroupNewTopicNotify 1.0 for phpBB 3

MODs Released by Other phpbb Sites
歡迎推薦非官方認證外掛,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群譯文組

版面規則
所謂「非官方認證外掛」是指未經官方認證,發表在 [3.0.x] MODs in Development 版面的外掛。

為了維護推薦外掛之品質,自即日起,如果要在這個版面推薦外掛,那麼請遵守底下格式,謝謝合作!

發文格式:
  • 外掛名稱:(原文/中文化名稱)
  • 外掛作者:(原文)
  • 外掛描述:(原文/中文化描述)
  • 外掛版本:(原文)
  • 外掛下載:(連結位址)
  • 資料來源:(連結位址)
    --
  • 中文化分享:(若外掛無須修改語言檔、或無須上傳語言檔,則免之。)
    --
  • 使用後心得:(簡單陳述您的安裝經驗、使用心得、或其他注意事項。)


p.s.
這個版面之發文,需經版主審核。
主題已鎖定
GaryFu
星球公民
星球公民
文章: 41
註冊時間: 2002-06-19 09:54
聯繫:

[外掛] 新文章群組通知 GroupNewTopicNotify 1.0 for phpBB 3

文章 GaryFu »

外掛名稱:GroupNewTopicNotify 1.0 by GaryFu
外掛作者:GaryFu <garyfu@gmail.com> http://garyfu.idv.tw
外掛版本:1.0
外掛描述:
  • 在發表新文章時,標題下方增加群組通知的下拉式選單
    文章送出後,會寄發新文章通知給所選擇的群組成員
外掛網站:http://code.google.com/p/groupnewtopicnotify/
--
安裝方法:

#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
// Start assigning vars for main posting page ...

#
#-----[ BEFORE, ADD ]------------------------------------
#
// Start GroupNewTopicNotify 1.0 by GaryFu
$sql = ' SELECT DISTINCT g.group_id, g.group_name, g.group_type ,ug.user_id ';
$sql.= ' FROM phpbb_user_group ug ';
$sql.= ' LEFT JOIN phpbb_groups g ON g.group_id=ug.group_id AND g.group_type!=3 ';
$sql.= ' WHERE ug.user_id=' . $user->data['user_id'] . ' AND g.group_id is not NULL AND g.group_receive_pm=1 ';
$sql.= ' ORDER BY group_name ASC ';

$result = $db->sql_query($sql);

$group_options = '';
while ($row = $db->sql_fetchrow($result))
{
$group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
// End GroupNewTopicNotify 1.0 by GaryFu

#
#-----[ FIND ]------------------------------------------
#
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")),

#
#-----[ AFTER, ADD ]------------------------------------
#
'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '', // GroupNewTopicNotify 1.0 by GaryFu

#
#-----[ OPEN ]------------------------------------------
#
includes\functions_posting.php

#
#-----[ FIND ]------------------------------------------
#
if (!sizeof($notify_rows))
{
return;
}

// Make sure users are allowed to read the forum

#
#-----[ BEFORE, ADD ]------------------------------------
#
// Start GroupNewTopicNotify 1.0 by GaryFu
if ( isset($_POST['n_group_list'])==true )
{
if (sizeof($notify_rows))
{
//$sql_ignore_users .= ', ' . implode(', ', array_keys($notify_rows));
}

// get group name list
$sql = 'SELECT group_name
FROM ' . GROUPS_TABLE .'
WHERE group_id in ( '. implode(', ', $_POST['n_group_list'] ) .')';
$result = $db->sql_query($sql);

$txt_group_name_list = '';
while ($row = $db->sql_fetchrow($result))
{
if (isset($row['group_name']))
{
$txt_group_name_list .= ' [' . $row['group_name'] .']';
}
}
$txt_group_name_list = substr($txt_group_name_list ,1 );

// get group user_id
$sql = 'SELECT user_id
FROM ' . USER_GROUP_TABLE .'
WHERE group_id in ( '. implode(', ', $_POST['n_group_list'] ) .')';
$result = $db->sql_query($sql);
$sql_group_users = '0 ';
while ($row = $db->sql_fetchrow($result))
{
if (isset($row['user_id']))
{
$sql_group_users .= ', ' . $row['user_id'];
}
}

$sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber
FROM ' . USERS_TABLE . " u
WHERE u.user_id NOT IN ($sql_ignore_users)
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
AND u.user_id IN (' .$sql_group_users. ')';
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$notify_rows[$row['user_id']] = array(
'user_id' => $row['user_id'],
'username' => $txt_group_name_list, //$row['username'],
'user_email' => $row['user_email'],
'user_jabber' => $row['user_jabber'],
'user_lang' => $row['user_lang'],
'notify_type' => 'group',
'template' => 'group_newtopic_notify',
'method' => $row['user_notify_type'],
'allowed' => false
);
}
$db->sql_freeresult($result);
}
// End GroupNewTopicNotify 1.0 by GaryFu

#
#-----[ OPEN ]------------------------------------------
#
styles\prosilver\template\posting_editor.html

#
#-----[ FIND ]------------------------------------------
#
<dd><input type="text" name="subject" id="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}{DRAFT_SUBJECT}" class="inputbox autowidth" /></dd>

#
#-----[ AFTER, ADD ]------------------------------------
#
<!-- Start GroupNewTopicNotify 1.0 by GaryFu -->
<!-- IF not S_PRIVMSGS and not S_SHOW_DRAFTS -->
<dt><label for="n_group_list">{L_GROUP_NEW_TOPIC_NOTIFY}:</label></dt>
<dd><select name="n_group_list[]" id="n_group_list "multiple="true" size="4" class="inputbox">{S_GROUP_OPTIONS}</select></dd>
<!-- ENDIF -->
<!-- End GroupNewTopicNotify 1.0 by GaryFu -->

#
#-----[ OPEN ]------------------------------------------
#
styles\subsilver2\template\posting_body.html

#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" width="22%"><b class="genmed">{L_SUBJECT}:</b></td>
<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}" /></td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------
#
<tr>
<td class="row1" width="22%"><b class="genmed">{L_SUBJECT}:</b></td>
<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="subject" size="45" maxlength="<!-- IF S_NEW_MESSAGE -->60<!-- ELSE -->64<!-- ENDIF -->" tabindex="2" value="{SUBJECT}" /></td>
</tr>

#
#-----[ OPEN ]------------------------------------------
#
language\en\posting.php
#
#-----[ FIND ]------------------------------------------
#
));

#
#-----[ BEFORE, ADD ]------------------------------------
#
'GROUP_NEW_TOPIC_NOTIFY' => 'Group Notify', // GroupNewTopicNotify 1.0 GaryFu

#
#-----[ OPEN ]------------------------------------------
#
language\zh_cmn_hant\posting.php
#
#-----[ FIND ]------------------------------------------
#
));

#
#-----[ BEFORE, ADD ]------------------------------------
#
'GROUP_NEW_TOPIC_NOTIFY' => '群組通知', // GroupNewTopicNotify 1.0 GaryFu

#
#-----[ CREATE NEW FILE ]------------------------------------------
#
language\en\email\group_newtopic_notify.txt

#
#-----[ EDIT ]------------------------------------
#
Subject: New topic notification - "{TOPIC_TITLE}"

Hello {USERNAME},

{SITENAME} has received a new topic :"{TOPIC_TITLE}"

If you want to view the topic, click the following link:

{U_TOPIC}

{EMAIL_SIG}

#
#-----[ CREATE NEW FILE ]------------------------------------------
#
language\zh_cmn_hant\email\group_newtopic_notify.txt

#
#-----[ EDIT ]------------------------------------
#
Subject: 新主題通知 - "{TOPIC_TITLE}"

親愛的 {USERNAME} 成員 您好,

討論區有新文章:{TOPIC_TITLE}

你可以點選以下連結瀏覽此文章:

{U_TOPIC}

{EMAIL_SIG}

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
#EoM
[/code]
--
詳細資訊可參考: http://code.google.com/p/groupnewtopicnotify/
圖檔
歡迎參觀我的網站
http://garyfu.idv.tw
主題已鎖定

回到「[3.0.x] 非官方認證外掛」