Skip to content

помогите исправить мод работает криво

вот весь мод:

 

/*
+-------------------------------------------------------
| Auto PM on Topic Modified 1.0.0
| ======================================================
| by Dzung Nguyen (ntd1712)
| (c) 2006 Vietnamese - Invision Resources
| http://www.invisionviet.net/
| ======================================================
| Date Started: Sat, 11 Feb 2006 20:01 (GMT+7)
| Last Updated: Mon, 01 Jan 2007 04:18 (GMT+7)
| License Info: http://www.invisionviet.net/license.php
+-------------------------------------------------------
*/

Based on module written by Bfarber
Completely rewritten by: ntd1712

QUOTE(Bfarber)
| All credits to Bfarber must remain in tact
| or use of this modification is not permitted!
|
| You are hereby glanted a non-exclusive right to 
| use this modification on any website you desire
| and you may modify this mod to suit your likings.
| The only requirements you must maintain to use
| this mod are that you may NOT upgrade or re-
| distribute this modification without my consent.

Compatibility: IPB v2.2.x
Description  :
- Auto send pm to the topic starter when a topic is edited/closed/moved/deleted, etc.

File to edit:
./cache/lang_cache/#/lang_mod.php
./sources/action_public/moderate.php
./sources/lib/func_mod.php

---------------------------------------------------------------------------------------------

Open: ./cache/lang_cache/#/lang_mod.php

Find:

$lang = array (

Add below:

'pm_sbj' => "Action has been taken on the topic(s) you started.",
'pm_msg' => "Topic(s), in [b]%s[/b] forum, that have been %s:\n\n[b]%s[/b]\n\nThis is an automatically generated message to you notify you of this action.\nIf you have any questions regarding this, please contact a staff member to rectify the problem.",
'pm_edit' => "edited",
'pm_close' => "closed",
'pm_open' => "opened",
'pm_pin' => "pinned",
'pm_unpin' => "unpinned",
'pm_approve' => "approved",
'pm_unapprove' => "unapproved",
'pm_move' => "moved to a new forum [b]%s[/b]",
'pm_merge' => "merged into a new topic (ID: #%s)",
'pm_delete' => "deleted",

---------------------------------------------------------------------------------------------

Open: ./sources/action_public/moderate.php

Find: [ function topic_approve_alter($type='approve') ]

	$this->modfunc->forum_recount( $this->forum['id'] );
	$this->modfunc->stats_recount();

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],$type);

==========================================

Find: [ function multi_topic_merge() ]

	//-----------------------------------------
	// Update the posts, remove old polls, subs and topic
	//-----------------------------------------

Add below:

	$this->ipsclass->lang['pm_merge'] = sprintf($this->ipsclass->lang['pm_merge'], "[url=\"{$this->ipsclass->base_url}showtopic={$main_topic_id}\"]{$main_topic_id}[/url]");
	$this->modfunc->send_msg(" IN(".implode(",",$merge_ids).")",'merge');

==========================================

Find: [ function multi_alter_topics($mod_action="", $sql="") ]

		$this->moderate_log( sprintf( $this->ipsclass->lang['acp_altered_topics'], $sql, implode(",",$this->tids) ) );

Add below:

		$this->modfunc->send_msg(" IN(".implode(",",$this->tids).")",$this->ipsclass->input['tact']);

==========================================

Find: [ function merge_complete() ]

	//-----------------------------------------
	// Update the posts, remove old polls, subs and topic
	//-----------------------------------------

Add below:

	$this->ipsclass->lang['pm_merge'] = sprintf($this->ipsclass->lang['pm_merge'], "[url=\"{$this->ipsclass->base_url}showtopic={$this->topic['tid']}\"]{$this->topic['tid']}[/url]");
	$this->modfunc->send_msg('='.$old_topic['tid'],'merge');

==========================================

Find: [ function do_edit() ]

	$this->ipsclass->update_forum_cache();

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],'edit');

==========================================

Find: [ function open_topic() ]

	$this->modfunc->topic_open($this->topic['tid']);

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],'open');

==========================================

Find: [ function close_topic() ]

	$this->modfunc->topic_close($this->topic['tid']);

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],'close');

==========================================

Find: [ function pin_topic() ]

	$this->modfunc->topic_pin($this->topic['tid']);

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],'pin');

==========================================

Find: [ function unpin_topic() ]

	$this->modfunc->topic_unpin($this->topic['tid']);

Add below:

	$this->modfunc->send_msg('='.$this->topic['tid'],'unpin');

---------------------------------------------------------------------------------------------

Open: ./sources/lib/func_mod.php

Find: [ function topic_delete($id, $nostats=0) ]

	$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'topics', 'where' => "tid".$tid ) );

Add above:

	$this->send_msg($tid,'delete');

==========================================

Find: [ function topic_move($topics, $source, $moveto, $leavelink=0) ]

	return TRUE;

Add above:

	$this->ipsclass->lang['pm_move'] = sprintf($this->ipsclass->lang['pm_move'], "[url=\"{$this->ipsclass->base_url}showforum={$moveto}\"]".$this->ipsclass->forums->forum_by_id[$moveto]['name']."[/url]");
	$this->send_msg($tid,'move');

==========================================

Find:

}

?>

Add above:

//-----------------------------------------
// send_msg
//-----------------------------------------

function send_msg($tid,$act='edit')
{
	if (! $this->ipsclass->member) return FALSE;

	$this->ipsclass->DB->simple_construct(array('select' => 'tid,title,starter_id', 'from' => 'topics', 'where' => "starter_id > 0 AND starter_id <> ".$this->ipsclass->member['id']." AND tid".$tid));
	$sql = $this->ipsclass->DB->simple_exec();

	if (! $this->ipsclass->DB->get_num_rows()) return FALSE;

	while ($r = $this->ipsclass->DB->fetch_row($sql))
	{
		$pms[$r['starter_id']][] = ($act == 'delete' || $act == 'merge') ? $r['title'] : "[url=\"{$this->ipsclass->base_url}showtopic={$r['tid']}\"]{$r['title']}[/url]";
	}

	$msglib = $this->ipsclass->load_class(ROOT_PATH.'sources/lib/func_msg.php', 'func_msg');
	$msglib->init();

	foreach ($pms as $k => $v)
	{
		$msglib->to_by_id	= $k;
		$msglib->from_member = $this->ipsclass->member;
		$msglib->msg_title   = $this->ipsclass->lang['pm_sbj'];
		$msglib->msg_post	= sprintf($this->ipsclass->lang['pm_msg'], "[url=\"{$this->ipsclass->base_url}showforum={$this->forum['id']}\"]{$this->forum['name']}[/url]", $this->ipsclass->lang['pm_'.$act], implode("\n", $v));
		$msglib->force_pm	= 1;
		$msglib->send_pm();
	}

	return TRUE;
}

---------------------------------------------------------------------------------------------

That's all! :)
©2006 ntd1712

 

мод работает но когда юзеру приходит ЛС с текстом ваша тема закрита и рядом линк указывающий на тему но этот линк не работает точнее бб код не обрабатывается вот к примеру в ЛС приходит точно такой код

 

[url="http://тест урл"]закрытая тема[/url]

 

Как можно это исправить?

Featured Replies

Tools&Settings -> Personal Message Set-up -> Allow BBCode in messages? - стоит Yes?

  • Author

конечно

 

 

когда отвечаешь на это ЛС то бб код восстанавливается

Это только на закрытие темы или сообщения о любых действиях приходят криво?

Тихо сам с собою... Не парсит он ббкоды при создании сообщения.

Вставьте немного кода в function send_msg(...)

 

Найти в функции send_msg() (func_mod.php)

		if (! $this->ipsclass->member) return FALSE;

добавить после

		require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
	$this->parser =  new parse_bbcode();
	$this->parser->ipsclass =& $this->ipsclass;
	$this->parser->allow_update_caches = 1;
$this->parser->parse_bbcode		= 1;

найти

			$msglib->msg_post	= sprintf($this->ipsclass->lang['pm_msg'], "[url=\"{$this->ipsclass->base_url}showforum={$this->forum['id']}\"]{$this->forum['name']}[/url]", $this->ipsclass->lang['pm_'.$act], implode("\n", $v));

добавить после

		$msglib->msg_post	= $this->parser->pre_db_parse( $msglib->msg_post );

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.