>>下載此說明檔
修改email寄發方式 (改成使用phpBB內發送email方式)
[php]<?
#################################################################
## Mod Title: GroupNewTopicEmail
## Mod Author: GaryFu <gary@garyfu.idv.tw> http://garyfu.idv.tw
## Mod Version: 1.2
## Mod Description:
## 在發表新文章時,標題下方新增參與群組的下拉式選單\r
## 選擇任一群組,則會寄發新文章通知給該群組成員
##
## v1.1 修改email部份
## v1.2 修改執行後無反應bug(reGroup變數接收問題)
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit: 4
## posting.php
## includes/functions_post.php
## templates/subSilver/posting_body.tpl
## language/lang_chinese_traditional_taiwan/lang_main.php
## Files To Add: 1
## language/lang_chinese_traditional_taiwan/email/group_newtopic.tpl
##
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------
#
include($phpbb_root_path . 'includes/emailer.'.$phpEx); //GroupNewTopicEmail by GaryFu
#
#-----[ FIND ]------------------------------------------
#
$bbcode_uid = '';
#
#-----[ AFTER, ADD ]------------------------------------
#
$reGroup = ( !empty($HTTP_POST_VARS['reGroup']) ) ? trim($HTTP_POST_VARS['reGroup']) : ''; //GroupNewTopicEmail by GaryFu
#
#-----[ FIND ]------------------------------------------
#
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
#
#-----[ REPLACE WITH ]------------------------------------
#
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length,$reGroup); //GroupNewTopicEmail by GaryFu
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('switch_not_privmsg', array());
#
#-----[ AFTER, ADD ]------------------------------------
#
//GroupNewTopicEmail by GaryFu start
$select_GPlist = '';
$select_JavaChk = "";
$tmpGroupID = "";
if ($userdata['user_id']!=""){
$sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id=".$userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group list', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$tmpGroupID.=",".$row['group_id'];
}
while ( $row = $db->sql_fetchrow($result) );
}
if ($tmpGroupID!=""){
$tmpGroupID=substr($tmpGroupID,1,strlen($tmpGroupID));
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
AND group_id in ( $tmpGroupID )
ORDER BY group_name";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain group list', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$select_GPlist .= "<select name=\"reGroup\">";
$select_GPlist .= "<option value=\"\">".$lang['Topic_Group_Send_SelectChoose']."</option>";
$select_GPlist .= "<option value=\"0\" selected>".$lang['Topic_Group_Send_SelectNo']."</option>";
do
{
$select_GPlist .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
$select_GPlist .= '</select>';
}
}
}
if ($select_GPlist!=""){
$select_GPlist = "<br><B>".$lang['Topic_Group_Send_FieldNote']." ".$select_GPlist." ".$lang['Topic_Group_Send_GroupNM']."</B>";
$select_JavaChk = " if (document.post.reGroup.value == \"\") { formErrors = \"".$lang['Topic_Group_Send_ChkNote']."\";}";
}
//GroupNewTopicEmail by GaryFu end
#
#-----[ FIND ]------------------------------------------
#
'SMILIES_STATUS' => $smilies_status,
#
#-----[ AFTER, ADD ]------------------------------------
#
'S_GROUP_SELECT' => $select_GPlist, //GroupNewTopicEmail by GaryFu
'S_GROUP_CHECK' => $select_JavaChk, //GroupNewTopicEmail by GaryFu
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
#
#-----[ REPLACE WITH ]------------------------------------
#
//include($phpbb_root_path . 'includes/emailer.'.$phpEx); //GroupNewTopicEmail by GaryFu
#
#-----[ FIND ]------------------------------------------
#
$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">';
#
#-----[ BEFORE, ADD ]------------------------------------
#
//GroupNewTopicEmail by GaryFu start
if ($reGroup!="0" && $reGroup!=""){
$emailer = new emailer($board_config['smtp_delivery']);
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$email_headers = "From: " . $board_config['board_email'] . "
Return-Path: " . $board_config['board_email'] . "
";
$topic_title=$post_subject;
$sql = "SELECT u.user_email as uemail ,g.group_name as gname FROM phpbb_users u,phpbb_groups g ,phpbb_user_group ug WHERE ug.group_id = $reGroup AND ug.user_pending =0 AND u.user_id = ug.user_id and g.group_id=ug.group_id";
$result = $db->sql_query($sql);
while ( $row = $db->sql_fetchrow($result) )
{
$emailer->use_template('group_newtopic', $row['user_lang']);
$emailer->email_address($row['uemail']);
$emailer->set_subject();
$emailer->extra_headers($email_headers);
$emailer->assign_vars(array(
'EMAIL_SIG' => str_replace('<br />', "
", "--
" . $board_config['board_email_sig']),
'USERNAME' => $row['gname'],
'TOPIC_TITLE' => $topic_title,
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id"
)
);
$emailer->send();
$emailer->reset();
}
}
//GroupNewTopicEmail by GaryFu end
#
#-----[ FIND ]------------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
#
#-----[ REPLACE WITH ]------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length ,&$reGroup) //GroupNewTopicEmail by GaryFu
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
if (document.post.message.value.length < 2) {
#
#-----[ BEFORE, ADD ]------------------------------------
#
{S_GROUP_CHECK} //GroupNewTopicEmail by GaryFu
#
#-----[ FIND ]------------------------------------------
#
<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
#
#-----[ AFTER, ADD ]------------------------------------
#
{S_GROUP_SELECT} <!--//GroupNewTopicEmail by GaryFu end -->
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------
#
//GroupNewTopicEmail by GaryFu star
$lang['Topic_Group_Send_FieldNote'] = "寄發文章通知給";
$lang['Topic_Group_Send_GroupNM'] = "群組";
$lang['Topic_Group_Send_SelectChoose'] = "請選擇";
$lang['Topic_Group_Send_SelectNo'] = "無";
$lang['Topic_Group_Send_ChkNote'] = "請選擇是否寄發文章通知給某群組";
//GroupNewTopicEmail by GaryFu end
#
#-----[ CREATE NEW FILE ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/email/group_newtopic.tpl
#
#-----[ EDIT ]------------------------------------
#
Subject: 新文章通知 - {TOPIC_TITLE}
Charset: big5
親愛的 {USERNAME} 成員 您好,
討論區有新文章:{TOPIC_TITLE}
你可以點選以下連結瀏覽此文章:
{U_TOPIC}
{EMAIL_SIG}
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
#EoM
?>[/php]
[外掛] 寄發 新文章通知 給 已加入的群組成員 v1.2
MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!
版主: 版主管理群
前往
- Announcement
- ↳ 系統公告區
- Support
- ↳ [3.3.x] 安裝與使用
- ↳ [3.3.x] 中文
- ↳ [3.3.x] 轉換
- ↳ [3.2.x] 安裝與使用
- ↳ [3.2.x] 中文
- ↳ [3.2.x] 轉換
- Extensions
- ↳ 官方認證擴充功能
- ↳ [3.2.x] 官方認證擴充功能
- ↳ [3.3.x] 官方認證擴充功能
- ↳ 非官方認證擴充功能
- ↳ 擴充功能問題討論
- Style
- ↳ 官方認證風格
- ↳ [3.2.x] 官方認證風格
- ↳ [3.3.x] 官方認證風格
- ↳ 風格問題討論
- Knowledge
- ↳ 教學文件庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- ↳ 3.3
- ↳ phpBB 技術文件與知識庫
- ↳ 2.0
- ↳ 3.0
- ↳ 3.1
- ↳ 3.2
- Non-phpBB specific
- ↳ 塔羅占卜
- ↳ 塔羅精華
- ↳ 每週運勢
- ↳ 我想發問
- ↳ 站長交流
- ↳ 自由軟體或免費軟體
- ↳ 架站
- ↳ AppServ
- ↳ WampServer
- ↳ XAMPP
- ↳ phpMyAdmin
- ↳ ExoBUD MP
- ↳ 4images
- ↳ Coppermine Photo Gallery
- ↳ 網路
- ↳ 文書
- ↳ 檔案
- ↳ 美工
- ↳ 系統
- ↳ 安全
- ↳ 多媒體
- ↳ 遊戲
- ↳ 光碟
- ↳ 休閒哈拉與心情小品
- ↳ 意見反應或無法分類
- Link
- ↳ 竹貓星球數位(股)
- ↳ FaceBook_phpBB3-官方中文支援
- ↳ SSD 不限流量-網站空間( .tw or .com.tw域名免費送)
- ↳ 推薦網站
- ↳ phpBB.com
- ↳ phpBBHacks.com
- Archives
- ↳ phpBB 3.1.x Forum Archive
- ↳ [3.1.x] 安裝與使用
- ↳ [3.1.x] 中文
- ↳ [3.1.x] 轉換
- ↳ [3.1.x] 官方認證風格
- ↳ phpBB 3.0.x Forum Archive
- ↳ [3.0.x] Support
- ↳ [3.0.x] 安裝與使用
- ↳ [3.0.x] 中文
- ↳ [3.0.x] 轉換
- ↳ [3.0.x] Mod
- ↳ [3.0.x] 官方認證外掛
- ↳ [3.0.x] 非官方認證外掛
- ↳ [3.0.x] 外掛問題討論
- ↳ [3.0.x] Style
- ↳ [3.0.x] 官方認證風格
- ↳ [3.0.x] 非官方認證風格
- ↳ [3.0.x] 風格問題討論
- ↳ phpBB2 Forum Archive
- ↳ Support
- ↳ phpBB 2 安裝與使用
- ↳ phpBB 2 plus 綜合討論
- ↳ MOD
- ↳ 官方認證外掛
- ↳ 非官方認證外掛
- ↳ 外掛問題討論
- ↳ Style
- ↳ 官方認證風格
- ↳ 非官方認證風格
- ↳ 風格問題討論