Posts: 94
Threads: 25
Joined: Dec 2011
Reputation:
0
2012-01-17, 12:56 AM
Hello,
When i deactivate my plugin they give me this error code :
Fatal error: Cannot redeclare find_replace_templatesets() (previously declared in /home/icypopx/public_html/forum/inc/adminfunctions_templates.php:22) in /home/icypopx/public_html/forum/inc/adminfunctions_templates.php on line 101
Please help ._.
Posts: 5,871
Threads: 10
Joined: May 2009
Reputation:
625
2012-01-17, 03:49 AM
which plugin ? give its link ..
Posts: 960
Threads: 67
Joined: Feb 2011
Reputation:
24
2012-01-17, 04:09 AM
(2012-01-17, 03:49 AM)ranjani Wrote: which plugin ? give its link ..
when the op says 'my plugin' does this mean he has written a plugin that fails to deactivate or some else's the link, plugin name and access would be good
Not in this land alone,
But be God's mercies known,
From shore to shore!
Lord make the nations see,
That men should brothers be,
And form one family,
The wide world ov'er
Posts: 13,283
Threads: 159
Joined: Oct 2010
Reputation:
1,290
2012-01-17, 04:20 AM
In the plugin file, look in the activate and deactivate function, it should have something like this:
require MYBB_ROOT . "inc/adminfunctions_templates.php";
Change the require to require_once.
Posts: 5,871
Threads: 10
Joined: May 2009
Reputation:
625
2012-01-17, 04:23 AM
(This post was last modified: 2012-01-17, 04:24 AM by ranjani.)
well JimR, I might have mistaken though this thread is in general support (neither in development nor in plugin support) ..
@JoshR, if you had written the plugin then please give its code in php tags .. Edit : not seen Yaldaram's response
Posts: 94
Threads: 25
Joined: Dec 2011
Reputation:
0
2012-01-17, 12:09 PM
It's goes same to all my plugin Idk why ._.
Posts: 13,283
Threads: 159
Joined: Oct 2010
Reputation:
1,290
2012-01-17, 01:32 PM
Did you change the plugins as I mentioned you earlier ?
(2012-01-17, 04:20 AM)Yaldaram Wrote: In the plugin file, look in the activate and deactivate function, it should have something like this:
require MYBB_ROOT . "inc/adminfunctions_templates.php";
Change the require to require_once.
Posts: 94
Threads: 25
Joined: Dec 2011
Reputation:
0
2012-01-17, 02:16 PM
<?php
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id: adminfunctions_templates.php 5297 2010-12-28 22:01:14Z Tomm $
*/
/**
* Find and replace a string in a particular template through every template set.
*
* @param string The name of the template
* @param string The regular expression to match in the template
* @param string The replacement string
* @param int Set to 1 to automatically create templates which do not exist for that set (based off master) - Defaults to 1
* @return bolean true if updated one or more templates, false if not.
*/
function find_replace_templatesets($title, $find, $replace, $autocreate=1)
{
global $db, $mybb;
$return = false;
$template_sets = array(-2, -1);
// Select all global with that title
$query = $db->simple_select("templates", "tid, template", "title = '".$db->escape_string($title)."' AND sid='-1'");
while($template = $db->fetch_array($query))
{
// Update the template if there is a replacement term or a change
$new_template = preg_replace($find, $replace, $template['template']);
if($new_template == $template['template'])
{
continue;
}
// The template is a custom template. Replace as normal.
$updated_template = array(
"template" => $db->escape_string($new_template)
);
$db->update_query("templates", $updated_template, "tid='{$template['tid']}'");
}
// Select all other modified templates with that title
$query = $db->simple_select("templates", "tid, sid, template", "title = '".$db->escape_string($title)."' AND sid > 0");
while($template = $db->fetch_array($query))
{
// Keep track of which templates sets have a modified version of this template already
$template_sets[] = $template['sid'];
// Update the template if there is a replacement term or a change
$new_template = preg_replace($find, $replace, $template['template']);
if($new_template == $template['template'])
{
continue;
}
// The template is a custom template. Replace as normal.
$updated_template = array(
"template" => $db->escape_string($new_template)
);
$db->update_query("templates", $updated_template, "tid='{$template['tid']}'");
$return = true;
}
// Add any new templates if we need to and are allowed to
if($autocreate != 0)
{
// Select our master template with that title
$query = $db->simple_select("templates", "title, template", "title='".$db->escape_string($title)."' AND sid='-2'", array('limit' => 1));
$master_template = $db->fetch_array($query);
$master_template['new_template'] = preg_replace($find, $replace, $master_template['template']);
if($master_template['new_template'] != $master_template['template'])
{
// Update the rest of our template sets that are currently inheriting this template from our master set
$query = $db->simple_select("templatesets", "sid", "sid NOT IN (".implode(',', $template_sets).")");
while($template = $db->fetch_array($query))
{
$insert_template = array(
"title" => $db->escape_string($master_template['title']),
"template" => $db->escape_string($master_template['new_template']),
"sid" => $template['sid'],
"version" => $mybb->version_code,
"status" => '',
"dateline" => TIME_NOW
);
$db->insert_query("templates", $insert_template);
$return = true;
}
}
}
return $return;
}
?>
This is my admin Function template.
Posts: 13,283
Threads: 159
Joined: Oct 2010
Reputation:
1,290
2012-01-17, 03:13 PM
No, its in your plugins. Open each plugin file one by one and look for the "require" (without quotes) and Change it into "require_once" (without quotes)
Posts: 94
Threads: 25
Joined: Dec 2011
Reputation:
0
2012-01-18, 12:54 AM
(This post was last modified: 2012-01-18, 12:58 AM by JoshR.)
|