MyBB Community Forums

Full Version: Can anyone make this small plugin supported for mybb 1.8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There was a plugin for 1.6 version of mybb. There are plenty of plugins which are working perfectly after changing the compatibility to 1.8* .

But in this case the plugin is not installing at all it's took me to page which shows me :- error 500 . i mean it's not installing at all.

The plugin's name is :- Trash can forum.

[attachment=43416]


if anyone plugin master seeing this please help me to get this. and this will be helpful to mybb too.

I know there is alternative plugin for this naming Trash Bin but it's function is not like this plugin.

Please someone help me with this.

trash.php :- 
<?php
/**
 *	Copyright � 2006 Nick Palmer, http://e-xarx.net
 *	Copyright � 2006-2008 CraKteR, crakter [at] gmail [dot] com
 *
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	@version $Id: trash.php 34 2008-08-14 19:12:19Z CraKteR $
 *	@copyright $LastChangedDate: 2008-08-14 21:12:19 +0200 (to, 14 aug 2008) $
 *	@author CraKteR <[email protected]>
 *
  * Thanks to FirefoxWiz who provided the Purge Trash button.
 */
 
if(!defined("IN_MYBB"))
{
    die("This file cannot be accessed directly.");
}

$plugins->add_hook('editpost_deletepost', 'trash', 0);
$plugins->add_hook('moderation_do_deletethread', 'thread_trash', 0);
$plugins->add_hook('moderation_do_deleteposts', 'moderation_trash', 0);
$plugins->add_hook('moderation_start', 'inline_trash', 100000);
$plugins->add_hook('forumdisplay_start', 'trash_show_button');

function trash_info()
{
	return array(
		'name'				=> 'Trash Can Forum',
		'description'		=> 'Deleted Threads Will Automatically be moved to this forum',
		'website'			=> '',
		'author'			=> 'CraKteR',
		'authorsite'		=> 'mailto:[email protected]',
		'version'			=> '2.0',
		'guid'				=> '732aeadd8e2572f35884cdb76bf8a398',
		'compatibility' 	=> '16*',
	);
}

function trash_activate()
{
	global $db;
	
	// Delete all settings to avoid duplicates
	$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN(
		'enabletrash', 
		'trashcanfid',
		'trash_closetopics'
	)");
	$db->delete_query("settinggroups", "name = 'trashcan'");
	
	$query = $db->simple_select("settinggroups", "COUNT(*) as rows");
	$rows = $db->fetch_field($query, "rows");

	$trash_group = array(
		'name'			=> 'trashcan',
		'title'			=> 'Trash Can Forum',
		'description'	=> 'Settings for the Trash Can Forum plugin.',
		'disporder'		=> $rows+1,
		'isdefault'		=> 'no'
	);

	$db->insert_query('settinggroups', $trash_group);
	$gid = $db->insert_id();

	$trash_setting_1 = array(
		'name'			=> 'enabletrash',
		'title'			=> 'Enable The Trash Can',
		'description'	=> 'Enable The Trash Can. If not enabled, all threads are deleted as normal',
		'optionscode'	=> 'onoff',
		'value'			=> 1,
		'disporder'		=> 1,
		'gid'			=> intval($gid)
	);

	$trash_setting_2 = array(
		'name'			=> 'trashcanfid',
		'title'			=> 'Trash Can Forum Id',
		'description'	=> 'Enter The ID Of The Forum You Wish The Trash Can To Be',
		'optionscode'	=> 'text',
		'value'			=> '',
		'disporder'		=> 2,
		'gid'			=> intval($gid)
	);
	$trash_setting_3 = array(
		'name'			=> 'trash_closetopics',
		'title'			=> 'Close The Topics?',
		'description'	=> 'Do You Want The Topics To Become Automatically locked in the trash?',
		'optionscode'	=> 'onoff',
		'value'			=> 1,
		'disporder'		=> 3,
		'gid'			=> intval($gid)
	);

	$db->insert_query('settings', $trash_setting_1);
	$db->insert_query('settings', $trash_setting_2);
	$db->insert_query('settings', $trash_setting_3);
	
	rebuildsettings();
	
	$template1 = array(
		"title"		=> "forumdisplay_deletebutton",
		"template"	=> "<a href=\"moderation.php?action=delete_trash&amp;fid={\$fid}\"><img src=\"{\$theme[\'imglangdir\']}/purgetrash.gif\" alt=\"Purge trash\" /></a>&nbsp;",
		"sid"		=> -1
	);
	$db->insert_query("templates", $template1);
	
	$template2 = array(
		"title"		=> "moderation_purgetrash",
		"template"	=> "<html>
<head>
<title>{\$mybb->settings[\'bbname\']} - {\$lang->purge_trash_threads}</title>
{\$headerinclude}
</head>
<body>
{\$header}
	<form action=\"moderation.php\" method=\"post\">
		<table border=\"0\" cellspacing=\"{\$theme[\'borderwidth\']}\" cellpadding=\"{\$theme[\'tablespace\']}\" class=\"tborder\">
			<tr>
				<td class=\"thead\"><strong>{\$lang->purge_next_threads}</strong></td>
			</tr>
			<tr>
				<td class=\"trow1\"><span style=\"font-size: 1em;\">{\$threads_left}</span></td>
			</tr>
		</table>
		<br />
		<input type=\"hidden\" name=\"action\" value=\"delete_trash\" />
		<input type=\"hidden\" name=\"fid\" value=\"{\$fid}\" />
		<div style=\"text-align: center\"><input type=\"submit\" class=\"button\" name=\"submit\" value=\"{\$lang->purge_next_threads}\" /></div>
	</form>
{\$footer}
</body>
</html>",
		"sid"		=> -1
	);
	$db->insert_query("templates", $template2);

	require MYBB_ROOT.'inc/adminfunctions_templates.php';
	find_replace_templatesets("forumdisplay_threadlist", '#{\$newthread}#', "{\$newthread}{\$deletebutton}");
}

function trash_deactivate()
{
	global $db;

	$db->delete_query("settings", "name IN('enabletrash', 'trashcanfid', 'trash_closetopics')");
	$db->delete_query("settinggroups", "name = 'trashcan'");
	$db->delete_query("templates", "title IN('moderation_purgetrash', 'forumdisplay_deletebutton')");
	rebuildsettings();

	require MYBB_ROOT.'inc/adminfunctions_templates.php';
	find_replace_templatesets("forumdisplay_threadlist", '#{\$deletebutton}#', "", 0);
}

function trash()
{
	global $cache, $db, $moderation, $tid, $pid, $fid, $newfid, $forumpermissions, $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $plugins, $session;

	$newfid = intval($mybb->settings['trashcanfid']);

	if($mybb->input['delete'] == 1 && $mybb->settings['enabletrash'] == 1 && $newfid != 0)
	{
		if(!isset($lang->thread_deleted))
		{
			$lang->load("moderation");
		}
		$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
		$firstcheck = $db->fetch_field($query, 'pid');
		$firstpost = ($firstcheck == $pid) ? 1 : 0;

		if($firstpost)
		{
			if($forumpermissions['candeletethreads'] == 1)
			{
				if($tid == 0)
				{
					$query = $db->simple_select("posts", "tid", "pid='$pid'");
					$tid = $db->fetch_field($query, 'tid');
				}

				$query = $db->simple_select("threads", "subject, fid", "tid='$tid'");
				$thread = $db->fetch_array($query);
				if($newfid != $thread['fid'])
				{
					move_thread();
					redirect("forumdisplay.php?fid=$fid", $lang->redirect_threaddeleted);		
				}
				return false;
			}
		}
		else
		{
			if($forumpermissions['candeleteposts'] == 1)
			{
				$query = $db->simple_select("posts", "*", "pid='$pid'");
				$post = $db->fetch_array($query);

				if($post['fid'] != $newfid)
				{
					move_post();
					redirect("showthread.php?tid=$tid", $lang->redirect_postdeleted);
				}
				return false;
			}
		}
	}
}

function thread_trash()
{
	global $cache, $db, $moderation, $tid, $pid, $fid, $newfid, $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $plugins, $session;

	$newfid = intval($mybb->settings['trashcanfid']);

	if($mybb->settings['enabletrash'] == 1 && $newfid != 0)
	{
		if($tid == 0)
		{
			$query = $db->simple_select("posts", "tid", "pid='$pid'");
			$tid = $db->fetch_field($query, 'tid');
		}
		$query = $db->simple_select("threads", "subject, fid", "tid='$tid'");
		$thread = $db->fetch_array($query);
		if($newfid != $thread['fid'])
		{
			move_thread();
			redirect("forumdisplay.php?fid=$fid", $lang->redirect_threaddeleted);
		}
	}
}

function inline_trash()
{
	global $db, $cache, $fid, $newfid, $tid, $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $groupscache, $forum_cache, $fpermcache, $usercache, $fpermissionscache, $plugins, $session, $moderation;

	$newfid = intval($mybb->settings['trashcanfid']);

	if($mybb->settings['enabletrash'] == 1 && $newfid != 0 && (($mybb->input['action'] == "do_multideletethreads" || $mybb->input['action'] == "do_multideleteposts") && $mybb->request_method == "post") || $mybb->input['action'] == 'delete_trash')
	{
		$tid = intval($mybb->input['tid']);
		$fid = intval($mybb->input['fid']);

		if($tid)
		{
			$thread = get_thread($tid);
			$fid = $thread['fid'];
			if(!$thread['tid'])
			{
				error($lang->error_invalidthread);
			}
			$modlogdata['tid'] = $tid;
		}

		if($fid)
		{
			$modlogdata['fid'] = $fid;
			$forum = get_forum($fid);
			if($newfid == $fid && $mybb->input['action'] != 'delete_trash')
			{
				return;
			}
			else if($newfid != $fid && $mybb->input['action'] == 'delete_trash')
			{
				return;
			}
		}
		$permissions = forum_permissions($fid);

		if($fid)
		{
			check_forum_password($fid, $forum['password']);
		}

		switch($mybb->input['action'])
		{
			case "do_multideletethreads":
				if(is_moderator($fid, "candeleteposts") != true)
				{
					if($permissions['candeletethreads'] != 1 || $mybb->user['uid'] != $thread['uid'])
					{
						error_no_permission();
					}
				}
				$threadlist = explode("|", $mybb->input['threads']);
				$done = false;
				if(is_array($threadlist))
				{
					foreach($threadlist as $tid)
					{
						$query = $db->simple_select("threads", "subject, fid, tid", "tid='$tid'");
						$thread = $db->fetch_array($query);
						if($newfid != $thread['fid'])
						{
							$tid = $thread['tid'];
							move_thread();
							$done = true;
							$fid = $thread['fid'];
						}
					}

					if($done)
					{
						redirect("forumdisplay.php?fid=$fid", $lang->redirect_inline_threadsdeleted);
					}
				}
				break;
			case "do_multideleteposts":
				if(is_moderator($fid, "candeleteposts") != true)
				{
					error_no_permission();
				}
				$movethread = true;
				$postlist = explode("|", $mybb->input['posts']);
				$done = false;
				$query = $db->simple_select("posts", "*", "tid='$tid'");
				$plist = array();
				while($post = $db->fetch_array($query))
				{
					if(in_array($post['pid'], $postlist))
					{
						$plist[] = $post;
					}
					else
					{
						$movethread = false;
					}
				}
				$fid = $plist[0]['fid'];
				if($movethread)
				{
					$query = $db->simple_select("threads", "subject, fid", "tid='$tid'");
					$thread = $db->fetch_array($query);
					if($newfid != $thread['fid'])
					{
						move_thread();
						redirect("forumdisplay.php?fid=".$thread['fid'], $lang->redirect_inline_threadsdeleted);
					}
				}
				else
				{
					if($newfid != $fid)
					{
						$insert_array = array(
							'dateline' => intval($plist[0]['dateline']),
							'lastpost' => intval($plist[0]['dateline']),
							'fid' => intval($newfid),
							'subject' => $db->escape_string($plist[0]['subject']),
							'uid' => intval($plist[0]['uid']),
							'username' => $db->escape_string($plist[0]['username']),
							'visible' => 1,
							'closed' => (($mybb->settings['trash_closetopics'] == 1) ? 'yes' : '')
						);
						$db->insert_query("threads", $insert_array);
						$newtid = $db->insert_id();
						foreach($plist as $post)
						{
							$update_array = array(
								'tid' => $newtid,
								'fid' => $newfid
							);
							$db->update_query("posts", $update_array, "pid=".$post['pid']);
						}
						update_thread_counters($tid, array('posts' => '-'.count($plist)));
						update_thread_counters($newtid, array('posts' => '+'.count($plist)));
						update_forum_counters($fid, array('posts' => '-'.count($plist)));
						update_forum_counters($newfid, array('posts' => '+'.count($plist)));
						update_first_post($tid);
						$cache->update_stats();
						redirect("showthread.php?tid=$tid", $lang->redirect_postsdeleted);
					}
				}
				break;
			case 'delete_trash':
				if(is_moderator($fid, "candeleteposts") != true)
				{
					if($permissions['candeletethreads'] != 1)
					{
						error_no_permission();
					}
				}

				$query = $db->simple_select("threads", "tid", "fid='$fid'", array("limit" => 100));
				$query2 = $db->simple_select("threads", "COUNT(*) AS threads", "fid='$fid'");
				$count = $db->fetch_field($query2, 'threads');

				$lang->load("trash");

				if($mybb->request_method != "post")
				{
					if($count == 1)
					{
						$threads_left = $lang->you_really_want_to_purge_the_thread;
					}
					else
					{
						$threads_left = str_replace('[1]', $count, $lang->you_really_want_to_purge_the_threads);
					}
				}
				else
				{
					if($count > 0)
					{
						while($thread = $db->fetch_array($query))
						{
							$moderation->delete_thread($thread['tid']);
							$count--;
						}
					}

					if($count == 1)
					{
						$threads_left = $lang->purge_thread_left;
					}
					else
					{
						$threads_left = str_replace('[1]', $count, $lang->purge_threads_left);
					}
				}

				if($count < 100)
				{
					$num = $count;
				}
				else
				{
					$num = 100;
				}

				if($num == 1)
				{
					$lang->purge_next_threads = $lang->purge_next_thread;
					$lang->purge_trash_threads = $lang->purge_trash_thread;
				}
				else
				{
					$lang->purge_next_threads = str_replace('[1]', $num, $lang->purge_next_threads);
				}
				
				add_breadcrumb($lang->purge_trash_threads);
				
				if($count > 0)
				{
					eval("\$moderate = \"".$templates->get("moderation_purgetrash")."\";");
					output_page($moderate);
					exit();
				}
				else
				{
					redirect("forumdisplay.php?fid=".$fid, $lang->redirect_inline_threadsdeleted);
				}
				break;
		}
	}
}

function moderation_trash()
{
	global $cache, $db, $mybb, $tid, $fid, $newfid, $lang, $thread, $moderation;

	$newfid = intval($mybb->settings['trashcanfid']);

	if($mybb->settings['enabletrash'] == 1 && $newfid != 0)
	{
		$movethread = true;
		$deletepost = $mybb->input['deletepost'];
		$query = $db->simple_select("posts", "*", "tid='$tid'");
		$plist = array();
		while($post = $db->fetch_array($query))
		{
			if($deletepost[$post['pid']] == 1)
			{
				$plist[] = $post;
			}
			else
			{
				$movethread = false;
			}
		}
		$fid = $plist[0]['fid'];
		if($movethread)
		{
			$query = $db->simple_select("threads", "subject, fid", "tid='$tid'");
			$thread = $db->fetch_array($query);
			if($newfid != $thread['fid'])
			{
				move_thread();
				redirect("forumdisplay.php?fid=".$thread['fid'], $lang->redirect_inline_threadsdeleted);
			}
		}
		else
		{
			if($newfid != $fid)
			{
				$insert_array = array(
					'dateline' => intval($plist[0]['dateline']),
					'lastpost' => intval($plist[0]['dateline']),
					'fid' => intval($newfid),
					'subject' => $db->escape_string($plist[0]['subject']),
					'uid' => intval($plist[0]['uid']),
					'username' => $db->escape_string($plist[0]['username']),
					'visible' => 1,
					'closed' => (($mybb->settings['trash_closetopics'] == 1) ? 'yes' : '')
				);
				$db->insert_query("threads", $insert_array);
				$newtid = $db->insert_id();
				foreach($plist as $post)
				{
					$update_array = array(
						'tid' => $newtid,
						'fid' => $newfid
					);
					$db->update_query("posts", $update_array, "pid=".$post['pid']);
				}
				
				update_thread_counters($tid, array('posts' => '-'.count($plist)));
				update_thread_counters($newtid, array('posts' => '+'.count($plist)));
				update_forum_counters($fid, array('posts' => '-'.count($plist)));
				update_forum_counters($newfid, array('posts' => '+'.count($plist)));
				update_first_post($tid);
				$cache->update_stats();
				redirect("showthread.php?tid=$tid", $lang->redirect_postsdeleted);
			}
		}
	}
}

function move_thread()
{
	global $cache, $db, $mybb, $tid, $fid, $newfid, $lang, $thread, $moderation;
	if(!is_object($moderation))
	{
		require_once MYBB_ROOT."inc/class_moderation.php";
		$moderation = new Moderation();
	}

	$moderation->move_thread($tid, $newfid, '');

	if($mybb->settings['trash_closetopics'] == 1)
	{
		$moderation->close_threads($tid);
	}

	$modlogdata['thread_subject'] = $thread['subject'];
	log_moderator_action($modlogdata, sprintf($lang->thread_deleted, $thread['subject']));
	$cache->update_stats();
}

function move_post()
{
	global $db, $cache, $post, $fid, $newfid, $mybb, $pid, $tid;
	if(!empty($post['subject']))
	{
		$post['subject'] .= " - ";
	}
	$post['subject'] .= "From #{$tid}";
	$insert_array = array(
		'dateline' => intval($post['dateline']),
		'lastpost' => intval($post['dateline']),
		'fid' => intval($newfid),
		'subject' => $db->escape_string($post['subject']),
		'uid' => intval($post['uid']),
		'username' => $db->escape_string($post['username']),
		'visible' => 1,
		'closed' => (($mybb->settings['trash_closetopics'] == 1) ? 'yes' : ''),
		'notes' => ''
	);
	$db->insert_query("threads", $insert_array);
	$newtid = $db->insert_id();

	$update_array = array(
		'tid' => $newtid,
		'fid' => $newfid
	);
	$db->update_query("posts", $update_array, "pid='$pid'");
	$affected = $db->affected_rows();
	
	$cache->update_stats();
	update_thread_counters($tid, array('posts' => '-'.$affected));
	update_thread_counters($newtid, array('posts' => '+'.$affected));
	update_forum_counters($newfid, array('posts' => '+'.$affected, 'threads' => '+1'));
	update_forum_counters($fid, array('posts' => '-'.$affected, 'threads' => '-1'));
}

function trash_show_button()
{
	global $deletebutton, $templates, $mybb, $theme;
	$delete = '';
	$fid = intval($mybb->input['fid']);

	if($fid == intval($mybb->settings['trashcanfid']) && is_moderator($fid, "candeleteposts") == true)
	{
		eval("\$deletebutton = \"".$templates->get("forumdisplay_deletebutton")."\";");
	}
}
?>
OK, you have gotten an error 500, but you should have more info about it also.
Check server logs.
<error>
	<dateline>1603178499</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/index.php:18]
</back_trace>
</error>

<error>
	<dateline>1603178501</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/css.php:15]
</back_trace>
</error>

<error>
	<dateline>1603178501</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/task.php:19]
</back_trace>
</error>

<error>
	<dateline>1603178513</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/showthread.php:28]
</back_trace>
</error>

<error>
	<dateline>1603178513</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/css.php:15]
</back_trace>
</error>

<error>
	<dateline>1603178514</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/task.php:19]
</back_trace>
</error>

<error>
	<dateline>1603178520</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/showthread.php:28]
</back_trace>
</error>

<error>
	<dateline>1603178520</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/showthread.php:28]
</back_trace>
</error>

<error>
	<dateline>1603178521</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/css.php:15]
</back_trace>
</error>

<error>
	<dateline>1603178525</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/task.php:19]
</back_trace>
</error>

<error>
	<dateline>1603178534</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/newreply.php:24]
</back_trace>
</error>

<error>
	<dateline>1603178535</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/global.php:20]
#4  require_once() called at [/private.php:26]
</back_trace>
</error>

<error>
	<dateline>1603178536</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/css.php:15]
</back_trace>
</error>

<error>
	<dateline>1603178537</dateline>
	<script>inc/plugins/ckeditor.php</script>
	<line>17</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Use of undefined constant CKEDITOR_PLUGINROOT - assumed 'CKEDITOR_PLUGINROOT' (this will throw an Error in a future version of PHP)</message>
	<back_trace>#0  errorHandler->error() called at [/inc/plugins/ckeditor.php:17]
#1  require_once() called at [/inc/class_plugins.php:38]
#2  pluginSystem->load() called at [/inc/init.php:239]
#3  require_once() called at [/task.php:19]
</back_trace>
</error>

<error>
	<dateline>1603381588</dateline>
	<script></script>
	<line>0</line>
	<type>20</type>
	<friendly_type>MyBB SQL Error</friendly_type>
	<message>SQL Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY username ASC' at line 6
Query: 
SELECT *
FROM mybb_users 
LEFT JOIN mybb_userfields 
ON mybb_users.uid = mybb_userfields.ufid 
WHERE mybb_users.usergroup IN (#,#,#,#)
ORDER BY username ASC
</message>
	<back_trace>#0  errorHandler->error() called at [/inc/db_mysqli.php:597]
#1  DB_MySQLi->error() called at [/inc/db_mysqli.php:337]
#2  DB_MySQLi->query() called at [/faceclaims.php:23]
</back_trace>
</error>

<error>
	<dateline>1603381591</dateline>
	<script></script>
	<line>0</line>
	<type>20</type>
	<friendly_type>MyBB SQL Error</friendly_type>
	<message>SQL Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY username ASC' at line 6
Query: 
SELECT *
FROM mybb_users 
LEFT JOIN mybb_userfields 
ON mybb_users.uid = mybb_userfields.ufid 
WHERE mybb_users.usergroup IN (#,#,#,#)
ORDER BY username ASC
</message>
	<back_trace>#0  errorHandler->error() called at [/inc/db_mysqli.php:597]
#1  DB_MySQLi->error() called at [/inc/db_mysqli.php:337]
#2  DB_MySQLi->query() called at [/faceclaims.php:23]
</back_trace>
</error>

<error>
	<dateline>1603464099</dateline>
	<script>inc/plugins/phptpl.php</script>
	<line>150</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>substr() expects parameter 1 to be string, array given</message>
	<back_trace>#0  errorHandler->error() called at [[PHP]: ]
#1  substr() called at [/inc/plugins/phptpl.php:150]
#2  phptpl_if() called at [/inc/plugins/phptpl.php:89]
#3  {closure}() called at [[PHP]: ]
#4  preg_replace_callback_array() called at [/inc/plugins/phptpl.php:109]
#5  phptpl_parsetpl() called at [/inc/plugins/phptpl.php(70) : eval()'d code:19]
#6  phptpl_templates->get() called at [/index.php:370]
</back_trace>
</error>

<error>
	<dateline>1603464106</dateline>
	<script>inc/plugins/phptpl.php</script>
	<line>150</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>substr() expects parameter 1 to be string, array given</message>
	<back_trace>#0  errorHandler->error() called at [[PHP]: ]
#1  substr() called at [/inc/plugins/phptpl.php:150]
#2  phptpl_if() called at [/inc/plugins/phptpl.php:89]
#3  {closure}() called at [[PHP]: ]
#4  preg_replace_callback_array() called at [/inc/plugins/phptpl.php:109]
#5  phptpl_parsetpl() called at [/inc/plugins/phptpl.php(70) : eval()'d code:19]
#6  phptpl_templates->get() called at [/index.php:370]
</back_trace>
</error>

<error>
	<dateline>1603464110</dateline>
	<script>inc/plugins/phptpl.php</script>
	<line>150</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>substr() expects parameter 1 to be string, array given</message>
	<back_trace>#0  errorHandler->error() called at [[PHP]: ]
#1  substr() called at [/inc/plugins/phptpl.php:150]
#2  phptpl_if() called at [/inc/plugins/phptpl.php:89]
#3  {closure}() called at [[PHP]: ]
#4  preg_replace_callback_array() called at [/inc/plugins/phptpl.php:109]
#5  phptpl_parsetpl() called at [/inc/plugins/phptpl.php(70) : eval()'d code:19]
#6  phptpl_templates->get() called at [/index.php:370]
</back_trace>
</error>

<error>
	<dateline>1603464116</dateline>
	<script>inc/plugins/phptpl.php</script>
	<line>150</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>substr() expects parameter 1 to be string, array given</message>
	<back_trace>#0  errorHandler->error() called at [[PHP]: ]
#1  substr() called at [/inc/plugins/phptpl.php:150]
#2  phptpl_if() called at [/inc/plugins/phptpl.php:89]
#3  {closure}() called at [[PHP]: ]
#4  preg_replace_callback_array() called at [/inc/plugins/phptpl.php:109]
#5  phptpl_parsetpl() called at [/inc/plugins/phptpl.php(70) : eval(

And the server error showing this :- 
Fatal error: Uncaught Error: Call to undefined function rebuildsettings() in /home/vol11_8/epizy.com/epiz_26803231/htdocs/inc/plugins/trash.php:110 Stack trace: #0 /home/vol11_8/epizy.com/epiz_26803231/htdocs/admin/modules/config/plugins.php(433): trash_activate() #1 /home/vol11_8/epizy.com/epiz_26803231/htdocs/admin/index.php(824): require('/home/vol11_8/e...') #2 {main} thrown in /home/vol11_8/epizy.com/epiz_26803231/htdocs/inc/plugins/trash.php on line 110

And from the line 106 to 116 is :- 
$db->insert_query('settings', $trash_setting_1);
	$db->insert_query('settings', $trash_setting_2);
	$db->insert_query('settings', $trash_setting_3);
	
	rebuildsettings();
	
	$template1 = array(
		"title"		=> "forumdisplay_deletebutton",
		"template"	=> "<a href=\"moderation.php?action=delete_trash&amp;fid={\$fid}\"><img src=\"{\$theme[\'imglangdir\']}/purgetrash.gif\" alt=\"Purge trash\" /></a>&nbsp;",
		"sid"		=> -1
	);
 110 line is rebuidsettings();
Got it ported so that it installs correctly on 1.8. MyBB 1.4 uses a deprecated rebuildsettings() function, whereas the 1.8 version is rebuild_settings(). There was also one query that needed to be changed. Besides that, very little needed to be changed.

I can't guarantee this will work correctly, but it does install and uninstall as it should! Smile
(2020-10-30, 12:44 AM)Darth Apple Wrote: [ -> ]Got it ported so that it installs correctly on 1.8. MyBB 1.4 uses a deprecated rebuildsettings() function, whereas the 1.8 version is rebuild_settings(). There was also one query that needed to be changed. Besides that, very little needed to be changed.

I can't guarantee this will work correctly, but it does install and uninstall as it should! Smile

Thank you so much for this , i can't explain how much i happy now ! you are just legend man. Adore you.
Is this plugin still working on PHP8 and current mybb version?
(2022-12-18, 09:03 AM)Tarekm Wrote: [ -> ]Is this plugin still working on PHP8 and current mybb version?

I would not suspect it would work on php 8, but based on previous replies it should work fine on the latest version.
After install, MyBB has experienced an internal SQL error and cannot continue.

There is a folder named .svn, Do I need to upload it?

Update: I uploaded the folder to the root directory: internal SQL error

PHP 8, mybb 1.8.32