php - Using $this when not in object context - MyBB -
so, i'm using mybb forums, , go moderate thread, , error.
fatal error: using $this when not in object context in c:\zpanel\hostdata\sdcore\public_html\forums\inc\class_moderation.php on line 642
the code on line 642 is
$this->delete_thread($mergetid);
and surrounding code (just in case)
$db->delete_query("threadsubscriptions", "tid = '{$mergetid}'"); update_first_post($tid); $arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject); $plugins->run_hooks("class_moderation_merge_threads", $arguments); $this->delete_thread($mergetid);
and delete thread function
function delete_thread($tid) { global $db, $cache, $plugins; $tid = intval($tid); $plugins->run_hooks("class_moderation_delete_thread_start", $tid); $thread = get_thread($tid); $userposts = array(); // find pid, uid, visibility, , forum post count status $query = $db->query(" select p.pid, p.uid, p.visible, f.usepostcounts ".table_prefix."posts p left join ".table_prefix."forums f on (f.fid=p.fid) p.tid='{$tid}' "); $pids = array(); $num_unapproved_posts = $num_approved_posts = 0; while($post = $db->fetch_array($query)) { $pids[] = $post['pid']; $usepostcounts = $post['usepostcounts']; if(!function_exists("remove_attachments")) { require mybb_root."inc/functions_upload.php"; } // remove attachments remove_attachments($post['pid']); // if post unapproved, count it! if($post['visible'] == 0 || $thread['visible'] == 0) { $num_unapproved_posts++; } else { $num_approved_posts++; // count post counts each user subtracted ++$userposts[$post['uid']]; } } // remove post count users if($usepostcounts != 0) { if(is_array($userposts)) { foreach($userposts $uid => $subtract) { $db->update_query("users", array('postnum' => "postnum-{$subtract}"), "uid='".intval($uid)."'", 1, true); } } } // delete posts , attachments if($pids) { $pids = implode(',', $pids); $db->delete_query("posts", "pid in ($pids)"); $db->delete_query("attachments", "pid in ($pids)"); $db->delete_query("reportedposts", "pid in ($pids)"); } // implied counters unapproved thread if($thread['visible'] == 0) { $num_unapproved_posts += $num_approved_posts; } // delete threads, redirects, subscriptions, polls, , poll votes $db->delete_query("threads", "tid='$tid'"); $db->delete_query("threads", "closed='moved|$tid'"); $db->delete_query("threadsubscriptions", "tid='$tid'"); $db->delete_query("polls", "tid='$tid'"); $db->delete_query("pollvotes", "pid='".$thread['poll']."'"); $db->delete_query("threadsread", "tid='$tid'"); $db->delete_query("threadratings", "tid='$tid'"); $updated_counters = array( "posts" => "-{$num_approved_posts}", "unapprovedposts" => "-{$num_unapproved_posts}" ); if($thread['visible'] == 1) { $updated_counters['threads'] = -1; } else { $updated_counters['unapprovedthreads'] = -1; } if(substr($thread['closed'], 0, 5) != "moved") { // update forum count update_forum_counters($thread['fid'], $updated_counters); } $plugins->run_hooks("class_moderation_delete_thread", $tid); return true; }
how go fixing this?
Comments
Post a Comment