Delka Опубликовано 13 Августа 2006 Жалоба Поделиться Опубликовано 13 Августа 2006 На invisionize.com есть мод Notify Member on Topic Approval, Move, and Deletion by bfarber Он отправляем PM автору темы от имени модера в случае её модерации. Написан он слегка кривовато.В первую очередь тем что вместо того чтобы сделать функцию для повторяющегося по всему моду кода, разработчик использовал copy/paste technology Ну это я исправил. Всё замечательно работает, но лишь когда модератор производит действия изнутри топика. Где нужно подправить что бы работало и при массовых действиях я не разобрался, надеюсь на вашу помощь. Вот сам мод: lang/russian/lang_global.php добавляем в начало: $lang['b_mod_message'] = "Ваша тема '%s' была %s. Это сообщение было автоматически создано для вашего уведомления."; $lang['b_mod_message_title'] = "Тема, которую вы создали, была подвергнута модерации."; $lang['b_mod_movetopic'] = "перемещена"; $lang['b_mod_approve_1'] = "одобрена"; $lang['b_mod_approve_0'] = "скрыта"; $lang['b_mod_delete'] = "удалена"; sources/moderate.php -----------------------------------------------------------------Находим:----------------------------------------------------------------- // If we have any HTML to print, do so... $print->add_output( $this->output ); $print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) ); } -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- function pm_on_action($fmessage) { global $ibforums; $this->newlib->init(); $this->newlib->register_class( &$this ); $to_mymessage['message'] = $ibforums->lang[$fmessage]; $to_mymessage['title'] = $this->topic['title']; $this->newlib->force_pm = 1; $this->post_key = md5(microtime()); $to_mymessage['msg_title'] = $ibforums->lang['b_mod_message_title']; $to_mymessage['Post'] = sprintf($ibforums->lang['b_mod_message'], $to_mymessage['title'], $to_mymessage['message']); $to = $this->topic['starter_id']; $this->newlib->to_by_id = $to; $this->newlib->from_member = $ibforums->member; $this->newlib->msg_title = $to_mymessage['msg_title']; $this->newlib->msg_post = $to_mymessage['Post']; $this->newlib->send_pm( array( 'save_only' => "", 'orig_id' => "", 'preview' => 0, 'track' => 0, 'add_sent' => 0, 'hide_cc' => 0 ) ); if ( $this->newlib->error != "" ) { $this->newlib->send_form( 0,$this->newlib->error ); $this->output .= $this->newlib->output; return; } } -----------------------------------------------------------------Находим:----------------------------------------------------------------- $approve_int = $type == 'approve' ? 1 : 0; $DB->do_update( 'topics', array( 'approved' => $approve_int ), 'tid='.$this->topic['tid'] ); $this->modfunc->forum_recount( $this->forum['id'] ); -----------------------------------------------------------------Immediately AFTER this code, add:----------------------------------------------------------------- $this->pm_on_action ("b_mod_approve_$approve_int"); -----------------------------------------------------------------Находим:----------------------------------------------------------------- //----------------------------------------- // Check for an attempt to move into a subwrap forum //----------------------------------------- while ( $f = $DB->fetch_row() ) { if ($f['id'] == $source_id) { $source_name = $f['name']; } else { $dest_name = $f['name']; } if ( ( $f['sub_can_post'] != 1 ) OR $f['redirect_on'] == 1 ) { $std->Error( array( 'LEVEL' => 1, 'MSG' => 'forum_no_post_allowed' ) ); } } $this->modfunc->topic_move( $this->tids, $source_id, $dest_id ); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_movetopic'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- //----------------------------------------- // Approve / Unapprove //----------------------------------------- if ( $this->mm_data['topic_approve'] ) { if ( $this->mm_data['topic_approve'] == 1 ) { $this->modfunc->stm_add_approve(); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_approve_1'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- } else if ( $this->mm_data['topic_approve'] == 2 ) { $this->modfunc->stm_add_unapprove(); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_approve_0'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- else { $DB->do_update( 'topic_mmod', array( 'topic_move' => 0 ), "mm_id=".$this->mm_id ); } -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_movetopic'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- if ( $this->trash_forum and $this->trash_forum != $this->forum['id'] ) { //----------------------------------------- // Move, don't delete //----------------------------------------- $this->modfunc->topic_move($this->tids, $this->forum['id'], $this->trash_forum); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_delete'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- } else { $this->modfunc->topic_delete($this->tids); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_delete'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- $ibforums->input['t'] = $this->topic['tid']; $this->moderate_log("Moved a topic from $source_name to $dest_name"); // Resync the forums.. $this->modfunc->forum_recount($source); $this->modfunc->forum_recount($moveto); -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_movetopic'); -----------------------------------------------------------------Находим:----------------------------------------------------------------- if ( $this->trash_forum and $this->trash_forum != $this->forum['id'] ) { //----------------------------------------- // Move, don't delete //----------------------------------------- $this->modfunc->topic_move($this->topic['tid'], $this->forum['id'], $this->trash_forum); $this->modfunc->forum_recount($this->forum['id']); $this->modfunc->forum_recount($this->trash_forum); $this->moderate_log("Applied trash can for delete topic"); } else { $this->modfunc->topic_delete($this->topic['tid']); $this->moderate_log("Deleted a topic"); } -----------------------------------------------------------------Добавляем ниже:----------------------------------------------------------------- $this->pm_on_action ('b_mod_delete'); Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Рекомендуемые сообщения
Присоединиться к обсуждению
Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.