2018-11-19, 01:03 PM
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:
Thanks!
I did it.
How?
I added this hook in the dvz_shoutbox.php plugin file:
Then I added this function under the dvz_shoutbox_info() function:
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:
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/ )