Add-on TaigaChat posted threads in shoutbox

Hi

I was wondering if someone was able to develop TaigaChat to have the ability to post in the shoutbox like

<username> just created the thread <nameofthread>

Whenever someone creates a thread or

<username just replied to the thread <nameofthread>

and have <nameofthread> hyperlinked to the thread so users could easily click and view reply's.

I had this when using my old shoutbox setup so it uses the DataWriter for the shoutbox at the end of every post and writes /me just posted the thread Thread name

But I over-wrote it when upgrading the forum and now cant remember how I did it. I also noticed that Taiga Chat doesnt have /me options.

If anyone could do this for me would be amazing :)
 
I am trying to do what digital doctor suggested in another thread -> http://xenforo.com/community/thread...thread-in-xfshout-shoutbox.24828/#post-395391. I found that \DataWriter\DiscussionMessage\Post.php in Digital Spy will probably work for my needs. However I am still new to xenforo and I am a bit unfamiliar with the formatting for sql inserts. Is there anyone who can pick out what I'm doing wrong with the insert. I would appreciate it
I get this error when someone tries to make a new post/reply
Undefined index: userid
'XenForo_Application::handlePhpError()inDigitalPointSpy/DataWriter/DiscussionMessage/Post.phpat line41'
Line 41 being the one starting with 'message'
Code:
$this->_db->insert('dark_taigachat', array(
'user_id' => XenForo_Visitor::getUserId(),
'username' => $this->_newData['xf_post']['username'],
'date' => XenForo_Application::$time,
'message' => '[url=http://seriouspants.net/members/' . $this->_newData['xf_post']['userid'] . ' ] ' .  $this->_newData['xf_post']['username'] . ' [/url] posted [url=http://seriouspants.net/posts/ ' . $this->_newData['xf_post']['post_id'] . '][/url]'
));
 
as an update I did get it succesfully running to some extent. However I am not able to call $this->_newData['xf_thread']['title'] to get the thread title for these new posts

Code:
//shoutbox post/thread
if (isset($this->_newData['xf_post']['post_id']) && isset($this->_newData['xf_post']['thread_id']))
{
$this->_db->insert('dark_taigachat', array(
'user_id' => XenForo_Visitor::getUserId(),
'username' => 'PostBot',
'date' => XenForo_Application::$time,
'message' => '[url=http://seriouspants.net/members/' . $this->_newData['xf_post']['user_id'] . ' ] ' .  $this->_newData['xf_post']['username'] . ' [/url] posted [url=http://seriouspants.net/posts/' . $this->_newData['xf_post']['post_id'] . ']' . $this->_newData['xf_post']['post_id'] . '[/url]'
));
}
 
as an update I did get it succesfully running to some extent. However I am not able to call $this->_newData['xf_thread']['title'] to get the thread title for these new posts

Code:
//shoutbox post/thread
if (isset($this->_newData['xf_post']['post_id']) && isset($this->_newData['xf_post']['thread_id']))
{
$this->_db->insert('dark_taigachat', array(
'user_id' => XenForo_Visitor::getUserId(),
'username' => 'PostBot',
'date' => XenForo_Application::$time,
'message' => '[url=http://seriouspants.net/members/' . $this->_newData['xf_post']['user_id'] . ' ] ' .  $this->_newData['xf_post']['username'] . ' [/url] posted [url=http://seriouspants.net/posts/' . $this->_newData['xf_post']['post_id'] . ']' . $this->_newData['xf_post']['post_id'] . '[/url]'
));
}
Keep working! :p
 
Sorry Dark for releasing this, if you wish I can remove this so you can put it in your premium version but since there hasn't been response to this post in a couple months I figured I would help a couple people out. Granted this probably can be done a much better way but I am still learning xenforo. It's only my second day. I know there is probably better way to call the threadtitle but I don't know how yet :(

This requires you have Digital Point : Spy http://xenforo.com/community/threads/digital-point-spy.22530/ (when I understand xenforo a bit better I can make my own little addon for it to release)
Once installed. Go here-> \library\DigitalPointSpy\DataWriter\DiscussionMessage\Post.php
Find this line
Code:
'action' => ($this->_newData['xf_post']['position'] == 0 ? 'thread' : 'post') . '_create'
));
}
Add under it (Keep in mind you will want to modify the message line in the array to change out the url part, and the user_id/username to the appropriate username/userid you want announcing the posts. I'm still learning how to generate xenforo urls I haven't had the chance to check to see if these work
$user_url = ( $this->_newData['xf_post']['user_id'] > 0 ? XenForo_Link::buildPublicLink('members', array('user_id' => $this->_newData['xf_post']['user_id'] , 'username' => $this->_newData['xf_post']['username'] )) : '');
$thread_url = XenForo_Link::buildPublicLink('full:threads', $thread); (put this in the foreach $topics_query as $thread loop)

PHP:
            //shoutbox post/thread
            if (isset($this->_newData['xf_post']['post_id']) && isset($this->_newData['xf_post']['thread_id']))
            { 
            if ($this->_newData['xf_post']['position'] == 0) {
            $posttype = "has created";
            } else {
            $posttype = "has replied to";
            }
                $threadid = $this->_newData['xf_post']['thread_id'];
                $sql_forum = "SELECT `title`, `thread_id` FROM `xf_thread` WHERE `thread_id` = '$threadid'";
                $topics_query = XenForo_Application::get('db')->fetchAll($sql_forum); 
                foreach ($topics_query as $thread)
                    {
                        $threadTitle = addslashes(XenForo_Template_Helper_Core::helperWordTrim($thread['title'], 100));
                    }     
                $this->_db->insert('dark_taigachat', array(
                    'user_id' => '431',
                    'username' => 'PostBot',                 
                    'date' => XenForo_Application::$time,
                    'message' => '[url=http://seriouspants.net/members/' . $this->_newData['xf_post']['user_id'] . ' ] ' .  $this->_newData['xf_post']['username'] . '[/url] '. $posttype .' [url=http://seriouspants.net/posts/' . $this->_newData['xf_post']['post_id'] . ']' . $threadTitle . '[/url]'
                ));
            }
 
Top Bottom