Browse Source

Revert "Fix thread creation"

This reverts commit bc8e0a49b8da0f20d5886b4c74cb8dee48cbee5e.
Angel Fernando Quiroz Campos 8 years ago
parent
commit
6508e0d092
2 changed files with 7 additions and 3 deletions
  1. 1 2
      main/forum/forumfunction.inc.php
  2. 6 1
      main/forum/newthread.php

+ 1 - 2
main/forum/forumfunction.inc.php

@@ -2968,8 +2968,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
             }
             Security::clear_token();
 
-            // Add new thread in table forum_thread.
-            store_thread($current_forum, $values);
+            return $values;
         }
     } else {
         $token = Security::get_token();

+ 6 - 1
main/forum/newthread.php

@@ -168,7 +168,7 @@ echo '</div>';
 // Set forum attachment data into $_SESSION
 getAttachedFiles($current_forum['forum_id'], 0, 0);
 
-show_add_post_form(
+$values = show_add_post_form(
     $current_forum,
     $forum_setting,
     'newthread',
@@ -176,6 +176,11 @@ show_add_post_form(
     isset($_SESSION['formelements']) ? $_SESSION['formelements'] : null
 );
 
+if (!empty($values) && isset($values['SubmitPost'])) {
+    // Add new thread in table forum_thread.
+    store_thread($current_forum, $values);
+}
+
 if (isset($origin) && $origin == 'learnpath') {
     Display::display_reduced_footer();
 } else {