MyBB Community Forums

Full Version: Problematic plugins - SOS!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I installed and tried to activate Musicalmidget's plugin (Downloads Section), but it refuses to activate. I get this message:
MySQL error: 1050
Table 'mybb_downloadcategories' already exists
Query: CREATE TABLE `mybb_downloadcategories` ( cid smallint unsigned NOT NULL auto_increment, name varchar(120) NOT NULL default '', description text NOT NULL default '', visiblegroups text NOT NULL default '', submissiongroups text NOT NULL default '', disporder smallint unsigned NOT NULL default '0', downloads int(10) NOT NULL default '0', PRIMARY KEY (`cid`) ) TYPE=MyISAM;

I'm currently using MyBB 1.2.6. Can anyone help me decipher this message?

Another problem with "Show Unanswered Threads" plugin by Zaher1988. I installed and literally followed the instructions. It activates but nothing is shown on the index page. I checked the global_lang.php and noticed that it added this line:
$l['welcome_unanswered'] = "View Unanswered Threads";
But it doesn't seem to have done anything else in the global.php, search.php or the adminfunctions_templates.php which are referred to in the readme.doc or plugin script:
<?php
/**
 * Mod Name: Show Unanwsered Threads 
 * Copyright TECHEX - The Site
 * http://www.thetechex.net
 */

if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

function sua_info()
{
    return array(
        "name"        => "Show Unanwsered Threads",
        "description"    => "It will show all threads with 0 replies.",
        "website"    => "http://www.thetechex.net",
        "author"    => "Zaher1988",
        "authorsite"    => "mailto:[email protected]",
        "version"    => "2.0",
    );
}

function sua_activate()
{

	global $db, $mybb, $lang, $templates;
	
	$language = $mybb->settings['bblanguage'];
	$tlurl = MYBB_ROOT."/inc/languages/english/global.lang.php";
	
	//edit txt file
	$fh = fopen($tlurl, "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize($tlurl)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN
	$newdata = preg_replace('#'.preg_quote('$l[\'welcome_todaysposts\']').'#','$l[\'welcome_unanswered\'] = "View Unanswered Threads";
	$l[\'welcome_todaysposts\']',$data); //REPLACE IN STRING
	$fw = fopen($tlurl, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN

	//Let's edit search
	
	$search_url = MYBB_ROOT."search.php";
	$fh = fopen($search_url, "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize($search_url)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN\
	$newdata = preg_replace('#'.preg_quote('elseif($mybb->input[\'action\'] == "do_search" && $mybb->request_method == "post")').'#','elseif($mybb->input[\'action\'] == "unanswered")
{
	$where_sql = "1=1";
	$where_sql .= " AND t.replies=\'0\'";
	
	$sid = md5(uniqid(microtime(), 1));
	$searcharray = array(
		"sid" => $db->escape_string($sid),
		"uid" => $mybb->user[\'uid\'],
		"dateline" => time(),
		"ipaddress" => $db->escape_string($session->ipaddress),
		"threads" => \'\',
		"posts" => \'\',
		"searchtype" => "titles",
		"resulttype" => "threads",
		"querycache" => $db->escape_string($where_sql),
	);

	$plugins->run_hooks("search_do_search_process");
	$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input[\'action\'] == "do_search" && $mybb->request_method == "post")',$data); //REPLACE IN STRING
	$fw = fopen($search_url, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN
		
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("header_welcomeblock_member", '#'.preg_quote('<a href="search.php?action=getdaily">{$lang->welcome_todaysposts}</a> |').'#', '<a href="search.php?action=getdaily">{\$lang->welcome_todaysposts}</a> | <a href="search.php?action=unanswered">{\$lang->welcome_unanswered}</a> |');

				}


function sua_deactivate()
{
	
	global $db, $mybb, $lang, $templates;
	$language = $mybb->settings['bblanguage'];
	$tlurl = MYBB_ROOT."/inc/languages/$language/global.lang.php";
	
	//edit txt file
	$fh = fopen($tlurl, "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize($tlurl)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN
	$newdata = preg_replace('#'.preg_quote('$l[\'welcome_unanswered\'] = "View Unanswered Threads";
	$l[\'welcome_todaysposts\']').'#','$l[\'welcome_todaysposts\']',$data); //REPLACE IN STRING
	$fw = fopen($tlurl, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN


	//Remove :(
	$search_url = MYBB_ROOT."search.php";
	$fh = fopen($search_url, "r") or cperror("Could not open file!"); //OPEN FILE
	$data = fread($fh, filesize($search_url)) or cperror("Could not read file!"); //MAKE TEMPORARY STRING
	fclose($fh); //CLOSE FILE AGAIN\
	$newdata = preg_replace('#'.preg_quote('elseif($mybb->input[\'action\'] == "unanswered")
{
	$where_sql = "1=1";
	$where_sql .= " AND t.replies=\'0\'";
	
	$sid = md5(uniqid(microtime(), 1));
	$searcharray = array(
		"sid" => $db->escape_string($sid),
		"uid" => $mybb->user[\'uid\'],
		"dateline" => time(),
		"ipaddress" => $db->escape_string($session->ipaddress),
		"threads" => \'\',
		"posts" => \'\',
		"searchtype" => "titles",
		"resulttype" => "threads",
		"querycache" => $db->escape_string($where_sql),
	);

	$plugins->run_hooks("search_do_search_process");
	$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}').'#','',$data); //REPLACE IN STRING
	$fw = fopen($search_url, "w") or cperror('Could not open file!'); //OPEN FILE AGAIN
	$fb = fwrite($fw, $newdata) or cperror('Could not write to file'); //WRITE STRING TO FILE
	fclose($fw); //CLOSE FILE AGAIN
	
require MYBB_ROOT."/inc/adminfunctions_templates.php";
	
	find_replace_templatesets("header_welcomeblock_member", '#'.preg_quote('<a href="search.php?action=unanswered">{$lang->welcome_unanswered}</a> |').'#', '',0);
}

?>

I appreciate your help.
Regards
maatty Wrote:I installed and tried to activate Musicalmidget's plugin (Downloads Section), but it refuses to activate. I get this message:
MySQL error: 1050
Table 'mybb_downloadcategories' already exists
Query: CREATE TABLE `mybb_downloadcategories` ( cid smallint unsigned NOT NULL auto_increment, name varchar(120) NOT NULL default '', description text NOT NULL default '', visiblegroups text NOT NULL default '', submissiongroups text NOT NULL default '', disporder smallint unsigned NOT NULL default '0', downloads int(10) NOT NULL default '0', PRIMARY KEY (`cid`) ) TYPE=MyISAM;

I'm currently using MyBB 1.2.6. Can anyone help me decipher this message?

You've installed it earlier ( or had a previous version ) but didn't deactivated ? You will need to delete the downloadcategories and downloads table through phpmyadmin or cpanel and while you are out there look into your adminoptions table and see if "canmanagedownloads" is present, if so, delete it also ... else you will get another error while trying to activate Wink

maatty Wrote:But it doesn't seem to have done anything else in the global.php, search.php or the adminfunctions_templates.php which are referred to in the readme.doc or plugin script:

Its global.lang.php [ Needed to be CHMOD 777 ], and it did add that line you were reffering too, thats enough ! adminsfunctions_templates.php is for changing your template, can you check if
 <a href="search.php?action=unanswered">{\$lang->welcome_unanswered}</a> 
is present in your header_welcomeblock_member template , if not add it. And did you CHMOD search.php to 777 ? Cause else the
code for search action isn't there, and you wont get much as result =P
LeX- Wrote:You've installed it earlier ( or had a previous version ) but didn't deactivated ?

Thanks a lot LeX- for your reply, I'll do as you recommended, and tell you about the results later on.

My very best wishes
maatty
LeX- Wrote:check if
 <a href="search.php?action=unanswered">{\$lang->welcome_unanswered}</a> 
is present in your header_welcomeblock_member template , if not add it. And did you CHMOD search.php to 777 ? Cause else the
code for search action isn't there, and you want get much as result =P
Thanks LeX- this one works fine now after adding the code you mentioned to the header_welcomeblock_member template. It wasn't there. Now, I'll work on the first problem.
Thanks a million
maatty
LeX- Wrote:You've installed it earlier ( or had a previous version ) but didn't deactivated ? You will need to delete the downloadcategories and downloads table through phpmyadmin or cpanel and while you are out there look into your adminoptions table and see if "canmanagedownloads" is present, if so, delete it also ... else you will get another error while trying to activate Wink

Dear Lex-
I did all the above deletions several times, and every time I try to activate the plugin, I get this message:
Quote:MySQL error: 1054
Unknown column 'maatty' in 'where clause'
Query: UPDATE mybb_adminoptions SET canmanagedownloads='yes' WHERE uid IN (maatty, admin)

Actually, I can't figure out what is needed here. Could you instruct me please. Thanks.
maatty Wrote:Dear Lex-
I did all the above deletions several times, and every time I try to activate the plugin, I get this message:
Quote:MySQL error: 1054
Unknown column 'maatty' in 'where clause'
Query: UPDATE mybb_adminoptions SET canmanagedownloads='yes' WHERE uid IN (maatty, admin)

Actually, I can't figure out what is needed here. Could you instruct me please. Thanks.

For that query it uses the $config['super_admins'] var ( located in your config.php ) ... Instead of adding the UID , you've added the USERNAME to that $config['super_admins'] list.

You are the admin i suppose ; so open your config.php and look after
$config['super_admins'] ; it should be $config['super_admins'] = '1';
No usernames, just UIDs seperated by comma.
LeX- Wrote:For that query it uses the $config['super_admins'] var ( located in your config.php ) ... Instead of adding the UID , you've added the USERNAME to that $config['super_admins'] list.

You are the admin i suppose ; so open your config.php and look after
$config['super_admins'] ; it should be $config['super_admins'] = '1';
No usernames, just UIDs seperated by comma.

Precisely, I did it and the plugin is finally activated. You have made my day LeX-. I'm so grateful indeed. I just have one last question if you don't mind: now that the plugin is activated, how do I make use of it, I can only see a "downloads" menu (with add category - modify/delete) in my ACP and that's all (I'm not even sure that this menu has do with the plugin). Now, how do I make use of it after adding a category? How can I use it in the forum itself? I promise this is going to be my last question.

Would love to see you visiting my forum.
My very best regards
maatty (Moh. Abdel Aaty)
http://edcu.net/forums