1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Forum Watch Error

Discussion in 'Troubleshooting and Problems' started by DRE, Jun 19, 2013.

  1. DRE

    DRE Well-Known Member

    I clicked on a subforum and got a forum watch error that would not let me view the subforum.

    Disabled all listeners and I still get this same error.



    Server Error

    Mysqli prepare error: Unknown column 'forum_watch.node_id' in 'on clause'

    1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    4. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 753
    5. Zend_Db_Adapter_Abstract->fetchRow() in XenForo/Model/Forum.php at line 29
    6. XenForo_Model_Forum->getForumById() in XenForo/ControllerHelper/ForumThreadPost.php at line 177
    7. XenForo_ControllerHelper_ForumThreadPost->getForumOrError() in XenForo/ControllerHelper/ForumThreadPost.php at line 38
    8. XenForo_ControllerHelper_ForumThreadPost->assertForumValidAndViewable() in XenForo/ControllerPublic/Forum.php at line 88
    9. XenForo_ControllerPublic_Forum->actionForum() in XenForo/FrontController.php at line 335
    10. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    11. XenForo_FrontController->run() in abadelabhaha/index.php at line 13
     
  2. DRE

    DRE Well-Known Member

    This error occurs only when logged in.
     
  3. Mike

    Mike XenForo Developer Staff Member

    Did you have a forum watching add-on installed in 1.1?
     
  4. DRE

    DRE Well-Known Member

    Not that I know of.

    addons00.jpg
     
  5. Mike

    Mike XenForo Developer Staff Member

    Did you ever have one installed?

    Can you run this query?
    Code:
    SHOW CREATE TABLE xf_forum_watch;
     
  6. DRE

    DRE Well-Known Member

    I think so many, many months ago. I ran it.

    Screen Shot 2013-06-19 at 7.45.22 AM.png
     
  7. Mike

    Mike XenForo Developer Staff Member

    I need the full text from that to be sure, but ideally you'd need to contact the author of that add-on as it didn't clean up its tables/columns on uninstall to see what needs to be cleaned up.

    In an ideal world, I'd say use your 1.1 backup, remove xf_forum_watch from it (and any forum watch remnants) and redo the upgrade.
     
  8. DRE

    DRE Well-Known Member

    xf_forum_watch CREATE TABLE `xf_forum_watch` (
    `user_id` int(10) unsigned NOT NULL,
    `forum_id` int(10) unsigned NOT NULL,
    `reply_subscribe` tinyint(3) unsigned NOT NULL DEFAULT '0',
    `notification_method` tinyint(3) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`user_id`,`forum_id`),
    KEY `forum_id_reply_subscribe` (`forum_id`,`reply_subscribe`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
     
  9. Mike

    Mike XenForo Developer Staff Member

    Yeah, that's not our version. The previous post applies.
     
  10. DRE

    DRE Well-Known Member

    *looks at BD Forum Watch Install.php file*

    Code:
    <?php
    class ForumWatch_Installer {
       public static function install() {
         $db = XenForo_Application::get('db');
         
         $found = $db->fetchRow("SHOW TABLES LIKE 'xf_forum_watch'");
         if (empty($found)) {
           $db->query("
             CREATE TABLE `xf_forum_watch` (
               user_id INT UNSIGNED NOT NULL,
               forum_id INT UNSIGNED NOT NULL,
               reply_subscribe TINYINT UNSIGNED NOT NULL DEFAULT 0,
               PRIMARY KEY (user_id, forum_id),
               KEY forum_id_reply_subscribe (forum_id, reply_subscribe)
             ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
           ");
         }
         
         if ($db->fetchRow("SHOW COLUMNS FROM `xf_forum_watch` LIKE 'notification_method'")) {
           // look good
         } else {
           $db->query("ALTER TABLE `xf_forum_watch` ADD COLUMN notification_method TINYINT UNSIGNED NOT NULL DEFAULT 0");
         }
       }
       
       public static function uninstall() {
         // temporary leave our table alone...
         // TODO: drop it
       }
    }
    
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Code:
    public static function uninstall() {
        // temporary leave our table alone...
        // TODO: drop it
      }
    Oh dear...
     
  12. DRE

    DRE Well-Known Member

    Well that doesn't sound good.
     
  13. Brogan

    Brogan XenForo Moderator Staff Member

    When you uninstalled the add-on, the table wasn't removed.

    The table name is exactly the same as a new table in 1.2 for the same function.

    Hence why your site is borked.
     
    Dan and DRE like this.
  14. DRE

    DRE Well-Known Member

    Oh it's all good. I'll close the site until the next upgrade.

    or just leave the chatbox up. Doesn't matter.
     
  15. Andy.N

    Andy.N Well-Known Member

    So I remove uninstall xfrocks Forum watch addon, drop the table xf_forum_watch, then rebuild master data again.

    It does not create that table for me when i rebuild master data. Do you have a sql query that I can run to manually recreate that table?
     
  16. xf_phantom

    xf_phantom Well-Known Member

    Code:
        CREATE TABLE xf_forum_watch (
            `user_id` int(10) unsigned NOT NULL,
            `node_id` int(10) unsigned NOT NULL,
            `notify_on` enum('','thread','message') NOT NULL,
            `send_alert` tinyint(3) unsigned NOT NULL,
            `send_email` tinyint(3) unsigned NOT NULL,
            PRIMARY KEY (`user_id`,`node_id`),
            KEY `node_id_notify_on` (`node_id`,`notify_on`)
        ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
    
     
  17. Andy.N

    Andy.N Well-Known Member

    You are the man. Thank you.
     
  18. DRE

    DRE Well-Known Member

    My site works now, thanks r.. man!
     
  19. xf_phantom

    xf_phantom Well-Known Member

    I hope you ALL had your lesson!

    DON'T RUN BETA on your livesite if you're not knowing what you're doing!
     
    Tracy Perry likes this.
  20. DRE

    DRE Well-Known Member

    I haven't learned anything thanks anyway though!
     
    Moshe1010, wcbryant and faeronsayn like this.

Share This Page