Are you good with phpbb code?

Discussion in 'HTML & Website Design' started by InternetTrickster, Aug 6, 2009.

  1. #1
    Ive already asked on 2 phpbb forums with no luck as of yet, im trying to edit a piece of code and cant make any sense of it.

    the code makes new topics and new replies appear as a status message in a shoubox... the code is:

              /* ============= mChat Start ============= */
              global $table_prefix;
              // Add name for db.
              define('MCHAT_TABLE', $table_prefix.'mchat');
              // New post/message.
              if ($post_mode == 'post')
              {
                // For new post
                $mchat_new_data = $user->lang['MCHAT_NEW_TOPIC'];
              }
                else
              {
                // For new message
                $mchat_new_data = $user->lang['MCHAT_NEW_REPLY'];
              }
              // Data...
              $message = utf8_normalize_nfc($mchat_new_data.': [url='.generate_board_url().'/viewtopic.'.$phpEx.'?p='.$data['post_id'].'#p'.$data['post_id'].']'.$subject.'[/url]');
              // Add function part code from [url]http://wiki.phpbb.com/Parsing_text[/url]
              $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
              generate_text_for_storage($message, $uid, $bitfield, $options, true, false, false);
              $sql_ary = array(
                'user_id' => $user->data['user_id'],
                'username' => $user->data['username'],
                'user_colour' => $user->data['user_colour'],
                'user_ip' => $user->data['session_ip'],
                'message' => $message,
                'bbcode_bitfield' => $bitfield,
                'bbcode_uid' => $uid,
                'bbcode_options' => $options,
                'message_time' => time()
              );
              $sql = 'INSERT INTO '.MCHAT_TABLE.' '.$db->sql_build_array('INSERT', $sql_ary);
              $db->sql_query($sql);
              /* ============== mChat End ============== */ 
    Code (markup):
    However I only want it to show new topics and not new replies/messages, So i took out the following piece of code from the above

            else
          {
            // For new message
            $mchat_new_data = $user->lang['NEW_MESSAGE'];
          }
    Code (markup):
    However this still made both new topics and new replies show up :confused:

    Anyone know what im doing wrong?
     
    InternetTrickster, Aug 6, 2009 IP
  2. miles2go

    miles2go Peon

    Messages:
    567
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yeah your doing it correct just remove other code. You are copying the both simultaniously.
     
    miles2go, Aug 6, 2009 IP
  3. InternetTrickster

    InternetTrickster Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ive already tried it with removing the 4 lines of code that looks like its related to "new replies" however its still showing new topics and new replies
     
    InternetTrickster, Aug 6, 2009 IP