آموزش رفع مشكل ماژول Subscription در فروم دیتالایف انجین نسخه 2.2 !
فایل engine/forum/action/addpost.php را باز كنید و به دنبال كد زیر بگردید:
if ($forum_config['subscription'] AND !$stop_subscription)
{
$all_subscr = $db->query("SELECT * FROM ". PREFIX ."_forum_subscription WHERE topic_id = '$topic_id' and user_id != '$member_id[user_id]'");
if ($db->num_rows($all_subscr))
{
include_once ENGINE_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$topic_link = $forum_url."showtopic={$topic_id}";
$topic_link_del = $config['http_home_url']."?do=forum&act=subscription&code=del&selected_id={$topic_id}";
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='subscription_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
while ($mail_row = $db->get_row($all_subscr))
{
$mail_result = str_replace("{%username_to%}", $mail_row['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_result);
$mail_result = str_replace("{%topic_name%}", "Тема $topic_id", $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%topic_link_del%}", $topic_link_del, $mail_result);
$mail_title = "Уведомление об ответах на подписанную тему";
$mail->send ($mail_row['email'], $mail_title, $mail_result);
}
}
}
{
$all_subscr = $db->query("SELECT * FROM ". PREFIX ."_forum_subscription WHERE topic_id = '$topic_id' and user_id != '$member_id[user_id]'");
if ($db->num_rows($all_subscr))
{
include_once ENGINE_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$topic_link = $forum_url."showtopic={$topic_id}";
$topic_link_del = $config['http_home_url']."?do=forum&act=subscription&code=del&selected_id={$topic_id}";
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='subscription_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
while ($mail_row = $db->get_row($all_subscr))
{
$mail_result = str_replace("{%username_to%}", $mail_row['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_result);
$mail_result = str_replace("{%topic_name%}", "Тема $topic_id", $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%topic_link_del%}", $topic_link_del, $mail_result);
$mail_title = "Уведомление об ответах на подписанную тему";
$mail->send ($mail_row['email'], $mail_title, $mail_result);
}
}
}
به جای آن كد زیر را قرار دهید:
if ($forum_config['subscription'] AND !$stop_subscription)
{
$all_subscr = $db->query("SELECT name, email FROM ". PREFIX ."_forum_subscription AS t1 INNER JOIN ". PREFIX ."_users AS t2 ON t1.user_id = t2.user_id WHERE t1.topic_id = $topic_id and t1.user_id != {$member_id['user_id']}");
if ($db->num_rows($all_subscr))
{
include_once ENGINE_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$topic_link = $forum_url."showtopic={$topic_id}";
$topic_link_del = $config['http_home_url']."?do=forum&act=subscription&code=del&selected_id={$topic_id}";
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='subscription_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
while ($mail_row = $db->get_row($all_subscr))
{
$mail_result = str_replace("{%username_to%}", $mail_row['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_result);
$mail_result = str_replace("{%topic_name%}", $topic_title, $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%topic_link_del%}", $topic_link_del, $mail_result);
$mail_title = "New Post In Subscription Topic";
$mail->send ($mail_row['email'], $mail_title, $mail_result);
}
}
}
{
$all_subscr = $db->query("SELECT name, email FROM ". PREFIX ."_forum_subscription AS t1 INNER JOIN ". PREFIX ."_users AS t2 ON t1.user_id = t2.user_id WHERE t1.topic_id = $topic_id and t1.user_id != {$member_id['user_id']}");
if ($db->num_rows($all_subscr))
{
include_once ENGINE_DIR.'/classes/mail.class.php';
$mail = new dle_mail ($config);
$topic_link = $forum_url."showtopic={$topic_id}";
$topic_link_del = $config['http_home_url']."?do=forum&act=subscription&code=del&selected_id={$topic_id}";
$mail_tpl = $db->super_query("SELECT template FROM " . PREFIX . "_forum_email where name='subscription_text' LIMIT 0,1");
$mail_tpl['template'] = stripslashes($mail_tpl['template']);
while ($mail_row = $db->get_row($all_subscr))
{
$mail_result = str_replace("{%username_to%}", $mail_row['name'], $mail_tpl['template']);
$mail_result = str_replace("{%username_from%}", $member_id['name'], $mail_result);
$mail_result = str_replace("{%topic_name%}", $topic_title, $mail_result);
$mail_result = str_replace("{%topic_link%}", $topic_link, $mail_result);
$mail_result = str_replace("{%topic_link_del%}", $topic_link_del, $mail_result);
$mail_title = "New Post In Subscription Topic";
$mail->send ($mail_row['email'], $mail_title, $mail_result);
}
}
}
همیشه پیروز و سربلند باشید !