Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.9, 3.1.10, 3.2.0-RC1
    • Fix Version/s: None
    • Component/s: Posting
    • Labels:
      None
    • Environment:
      PHP 5.4.1, MySQL 5.1.3, IE11

      Description

      When using submit_post from a script it will insert post but sends wrong username, user_id and user_colour to topics- and forum table as last poster.
      Example: In ACP I import with a extension a post from Facebook. As username I use the name from the Facebook author and post under username anonymous. The post is added in post table without a problem but in topic and forum table it used my login name and user_id resulting in a wrong display at forumlevel.

      Possible solution in function submit_post:line 1809

         $sql_data[TOPICS_TABLE]['sql'] = array(
          'topic_last_post_id'  => $data_ary['post_id'],
          'topic_last_post_time'  => $current_time,
          'topic_last_poster_id'  => $sql_data[POSTS_TABLE]['sql']['poster_id'],
         // 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'],
          'topic_last_poster_name' => ($sql_data[POSTS_TABLE]['sql']['poster_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'],
         // 'topic_last_poster_colour' => $user->data['user_colour'],
          'topic_last_poster_colour' => ($sql_data[POSTS_TABLE]['sql']['poster_id'] == ANONYMOUS) ? $sql_data['poster_colour'] : $user->data['user_colour'],
          'topic_last_post_subject' => (string) $subject,
         );
      

      and line 1827

        if ($post_visibility == ITEM_APPROVED)
        {
         if ($post_mode == 'post')
         {
          $config->increment('num_topics', 1, false);
         }
         $config->increment('num_posts', 1, false);
       
         $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data_ary['post_id'];
         $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
         $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time;
        // $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id'];
         $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $sql_data[POSTS_TABLE]['sql']['poster_id'];
         
        // $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'";
         $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . (($sql_data[POSTS_TABLE]['sql']['poster_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username']) . "'";
         
       //  $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'";
         $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . (($sql_data[POSTS_TABLE]['sql']['poster_id'] == ANONYMOUS) ? $sql_data['poster_colour'] : $user->data['user_colour']) . "'";
        }
      

        Attachments

        1. index.jpg
          index.jpg
          9 kB
        2. viewforum.jpg
          viewforum.jpg
          18 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              John P John P
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: