Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make DVZ Shoutbox broadcast the new threads
#1
Hi,

I want DVZ Shoutbox to say "X has created a new thread titled X in the category X" - I've seen a lot of forums that use DVZ Shoutbox done that but I can't find such option in the DVZ Shoutbox settings :/

Like that: [Image: Capture.jpg]

Thanks!


I did it.

How?

I added this hook in the dvz_shoutbox.php plugin file:

$plugins->add_hook('newthread_do_newthread_end', "NEWTHREAD_BROADCAST");

Then I added this function under the dvz_shoutbox_info() function:

function NEWTHREAD_BROADCAST() {
	global $db, $mybb, $tid;
	$GET_THREAD_INFO = $db->query("SELECT * FROM ".TABLE_PREFIX."threads WHERE tid='$tid'");
	$thread_row = $GET_THREAD_INFO->fetch_assoc();
	$GET_CATEGORY_INFO = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid='".$thread_row['fid']."'");
	$category_row = $GET_CATEGORY_INFO->fetch_assoc();
	 $db->insert_query('dvz_shoutbox', [
        'uid'       => intval($thread_row['uid']),
        'text'      => "[b][i]New thread [url=".$mybb->settings['bburl']."/showthread.php?tid=$tid]".$thread_row['subject']."[/url] posted in [url=".$mybb->settings['bburl']."/forumdisplay.php?fid=".$thread_row['fid']."]".$category_row['name']."[/url][/i][/b]",
        'date'      => TIME_NOW,
        'ipaddress' => $db->escape_binary( my_inet_pton('127.0.0.1') ),
    ]);
}
Thanks to this awesome plugins tutorial: https://community.mybb.com/thread-123172.html and the plugins hook documentation ( https://docs.mybb.com/1.8/development/plugins/hooks/ )
Reply
#2
https://github.com/Qwizi/DVZ-ShoutBox-Bot

You can use this plugin too.
Reply
#3
Great, good job
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#4
how to make it BROADCAST new granted awards & membership !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)