cBB Chat 1.1.0 - Forum topics in the chat


Due to a lack of free time, both support on this forum and extension development are currently limited.
All bugs are noted and saved for fixes, even if there are no replies to the posts.
Normal activity will resume as soon as possible.
no_avatar
dlv
 
Posts: 7
Joined: Sun Feb 08, 2015 8:32 am
 Mon Feb 16, 2015 8:38 pm • via Web
When you enable show new forum topics in chat, you get this:
New topic: topic title (with link to that new topic)

Is it possible to do it like this?
New topic: topic title (with link to that new topic) in forum titel (with link to that forum)
New reply: topic title (with link to that reply) in forum (with link to that forum)
User avatar
IvanPF
Administrator
 
Posts: 2252
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Sat Feb 21, 2015 12:29 pm • via Web
dlv wrote:New topic: topic title (with link to that new topic) in forum titel (with link to that forum)

This is possible, you need to do this changes:

1. Open /ext/canidev/chat/chat_ajax.php
2. Find:
Code: Select all
               $sql = 'SELECT topic_id, forum_id, topic_title, topic_time, topic_visibility, topic_first_post_id,
                  topic_poster AS poster_id, topic_first_poster_name AS poster_username
                  FROM ' . TOPICS_TABLE . "
                  WHERE topic_time > $last_update
                  ORDER BY topic_time DESC";

3.Replace with:
Code: Select all
               $sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.topic_visibility, t.topic_first_post_id,
                  t.topic_poster AS poster_id, t.topic_first_poster_name AS poster_username, f.forum_name
                  FROM ' . TOPICS_TABLE . ' t
                     LEFT JOIN ' . FORUMS_TABLE . " f ON(f.forum_id = t.forum_id)
                  WHERE topic_time > $last_update
                  ORDER BY topic_time DESC";

4. Find:
Code: Select all
                     $ary += array(
                        'IS_TOPIC'         => true,
                        'TOPIC_TITLE'      => censor_text($row['topic_title']),
                        'S_DATE'         => $this->user->format_date($row['topic_time']),
                        
                        'U_TOPIC'         => append_sid($this->root_path . 'viewtopic.' . $this->php_ext . '?f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
                        'U_TOPIC_EDIT'      => ($edit_allowed) ? append_sid($this->root_path . 'posting.' . $this->php_ext, 'mode=edit&f=' . $row['forum_id'] . '&p=' . $row['topic_first_post_id']) : '',
                     );

5.Replace with:
Code: Select all
                     $ary += array(
                        'IS_TOPIC'         => true,
                        'FORUM_NAME'      => $row['forum_name'],
                        'TOPIC_TITLE'      => censor_text($row['topic_title']),
                        'S_DATE'         => $this->user->format_date($row['topic_time']),
                        
                        'U_FORUM'         => append_sid($this->root_path . 'viewforum.' . $this->php_ext . '?f=' . $row['forum_id']),
                        'U_TOPIC'         => append_sid($this->root_path . 'viewtopic.' . $this->php_ext . '?f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
                        'U_TOPIC_EDIT'      => ($edit_allowed) ? append_sid($this->root_path . 'posting.' . $this->php_ext, 'mode=edit&f=' . $row['forum_id'] . '&p=' . $row['topic_first_post_id']) : '',
                     );


6. Open /ext/canidev/chat/styles/{your style or prosilver}/template/chat_ajax.html
7. Find:
Code: Select all
<strong>{L_NEW_TOPIC}:</strong> <a href="{message.U_TOPIC}">{message.TOPIC_TITLE}</a>

8. Add after:
Code: Select all
{L_IN} <a href="{message.U_FORUM}">{message.FORUM_NAME}</a>


9. Go to ACP > General and Purge the cache.

dlv wrote:New reply: topic title (with link to that reply) in forum (with link to that forum)

In teory, this is possible, but it would consume many resources in forums with a lot of movement.
no_avatar
dlv
 
Posts: 7
Joined: Sun Feb 08, 2015 8:32 am
 Sat Feb 21, 2015 2:26 pm • via Web
dlv wrote:New topic: topic title (with link to that new topic) in forum titel (with link to that forum)

Just tested and it's working fine
IvanPF wrote:
dlv wrote:New reply: topic title (with link to that reply) in forum (with link to that forum)

In teory, this is possible, but it would consume many resources in forums with a lot of movement.

I know, but i like to use this on my forum.
I think the query can be easy made so thet every New Post (with a link to New Post) comes in the chat instead of splitting New Topic or New Reply like i asked in my first post.
So will you write this query to do that please? And also change this 2 arrays conform the query?
Code: Select all
'U_TOPIC'         => append_sid($this->root_path . 'viewtopic.' . $this->php_ext . '?f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
                        'U_TOPIC_EDIT'      => ($edit_allowed) ? append_sid($this->root_path . 'posting.' . $this->php_ext, 'mode=edit&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['topic_first_post_id']) : '',

Thank you very much

Who is online

Users browsing this forum: No registered users and 0 guests