phpBBHacks.com - new topics announced in ajaxchat
Talk martial arts at KarateForums.com
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Username:    Password:
Remember Me?    
   I Lost My Password!
Bookmark and Share
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 3 Hack Support
 See a User Guidelines violation? Please contact us.
Author Message

Atmos
Not So New User

Joined: 28 Jan 2004
Posts: 51

PostPosted: August 16th 2010, 4:29 pm    Post subject: new topics announced in ajaxchat Reply with quote

Hello all,

I have a piece of code that will announce new topics and announce replys in the ajaxchat (blueimp)..

The problem is, it also post topics when someone replys but I just want new topics posted in the chat. Can someone tell me what code i have to change?

Thanx in advance!

Heres the code:

Code:
   $true_title = (($mode == 'edit') || (empty($post_data['topic_title']))) ? $post_data['post_subject'] : $post_data['topic_title']; // Also catch edits to the original post topic_title :D

// Remove all the http formatting from the topic_title
        $str_from = array('<', '>', '[', ']', '.', ':', ':','&', '"');
             $str_to = array('<', '>', '[', ']', '.', ':', ':','&','"');
            $clean_title = str_replace($str_from, $str_to, $true_title);

         $chat_post =  '[url=' . generate_board_url();               // Get the board url
  $chat_post .= '/viewtopic.php?f=' . $data['forum_id'] . '&t=' . $topic_id . '&p=' . $data['post_id'] . '#p' . $data['post_id'] . ']' . $clean_title . '[/url]';


        // Get 'poster_id' details
          $csql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . $data['poster_id'];
        $result = $db->sql_query($csql);
        $poster_info = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);

        $chat_post .= ' by [b][color=#' . $poster_info['user_colour'] . ']' . $poster_info['username'] . '[/color][/b]';

        $sql_ary = array(
'ip' => (string) 'ip',                   // Ip skip
'userID' => (int) 123456,                       // I chose this.. dunno why
'userName' => (string) 'Bot',             // You may change this name into what you want it to be :D
'userRole' => (int) 2,                          // I give it moderator status (I like that colour)
'channel' =>  (int) 0,                          // Chat channel # where the post goes, will be written below
'dateTime' => date('Y-m-d H:i:s'),              // Must give it the current time or it wont appear
'text' => (string) $chat_post                   // The chat message (defined above)



  );
         
// Define which forum_id's are open to which group_id's

        $validate = array ( array ( 'group_id' => (int) 19356,  // Groupnumber having access to the particular forum_id
                                    'forum_id' => (int) 12   // Same as 1st chat channel, actualluy a forum_id
                                  )
                         

 );

        $num_chnls = sizeof($validate);

        for ($chnl = 0; $chnl < $num_chnls; $chnl++)
          { // Check if the current topic is in a forum(_id) open to a group(_id) (of which users can be members)
            $read_acl = 'SELECT * FROM ' . ACL_GROUPS_TABLE . ' WHERE forum_id = ' . $data['forum_id'] . ' AND group_id = ' . $validate[$chnl]['group_id'];
          $result = $db->sql_query($read_acl);

      $chat_row = $db->sql_fetchrow($result);
       
   $db->sql_freeresult($result);
         
          if ($chat_row)
            { // If the rights are there, post the message for this chat/forum_if (they are the same!)
            $sql_ary['channel'] = $validate[$chnl]['forum_id'];
               $chat_sql = 'INSERT INTO ajax_chat_messages ' . $db->sql_build_array('INSERT', $sql_ary);
            $db->sql_query($chat_sql);
            $db->sql_freeresult($chat_sql);
            }
          }
Back to top
View user's profile Send private message

Thoul
VIP

Joined: 30 Jul 2002
Posts: 18040
Location: USA

PostPosted: August 19th 2010, 4:42 pm    Post subject: Reply with quote

Assuming that code is in posting.php or the submit_post() function in functions_posting.php, using something like this should work:
Code:

if ($mode == 'post')
{
       // All of that code you posted goes here
}

_________________
Fringes of Algo - Phantasy Star Community
TV Blitz Forums - Television Discussion Community
phpBB Smith: Modifications

70+ Listings @ phpBBHacks.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 3 Hack Support All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil - phpBB Portugal - phpBBpersian.com

Network: iFroggy Hosting - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - KarateForums.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Disclosure Policy - Staff - User Guidelines >

Copyright © 2001-2012. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.