MyBB Community Forums

Full Version: Post Body Issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Well as you can see the post area is not working, this is after I recently tried installing a different post editor through different plugins:

Advanced Quick Reply Form (1.0.3)
This plugin adds the MyCode Editor and the Smilie Inserter to the Quick Reply form.
Created by Phenomenon

MyBB WYSIWYG Editor (1.0.3)
Add advanced editor without HTML to MyBB
Created by mamaly12h

The latter woudn't even install hence why I tried advanced, with the "WYS..." editor this error was shown after attempting to activate:

Fatal error: Cannot redeclare find_replace_templatesets() (previously declared in /home/steamava/public_html/domaingamerone.net/inc/adminfunctions_templates.php:22) in /home/steamava/public_html/domaingamerone.net/inc/adminfunctions_templates.php on line 101

Now when you post a new thread you get a box which doesn't let you type anything inside or just nothing as shown below.

Image 1: No post body area.
http://img715.imageshack.us/img715/8452/nopostbox.png

Another request including the support for these errors I have is that if you could point me in the right direction of having a post box just like you have on this support forum (yes that nice blue coloured one) I would greatly appreciate that as well.

Have a good day!
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
(2011-01-03, 04:24 PM)gamerone.net Wrote: [ -> ]Another request including the support for these errors I have is that if you could point me in the right direction of having a post box just like you have on this support forum (yes that nice blue coloured one) I would greatly appreciate that as well.

ACP > Themes > Select your theme > Edit [Options] > and select "Office 2007" in "Editor Style" option.
Thanks for the editor tip, I will try it soon.

I tried the require change but it's not found in my adminfunctions_templates.php

EDIT: Looked in the wrong file, sorry but the actual file has require_once and no require.

Ok I tried the "WYS..." plugin it doesn't have any require but it does have

include MYBB_ROOT."/inc/adminfunctions_templates.php";
on line 33 and once again on line 79
include MYBB_ROOT."/inc/adminfunctions_templates.php";

<?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 5164 2010-08-02 03:35:35Z RyanGordon $
 */

/**
 * 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;
}
?>

and the plugins are not activated and un-installed but the problem is there show in the image 1.
No, the code you need to look for is in the plugin file, like Shukaku said...
Yes I looked in that as I said in the edit, and in "WYS" there is no require, and in the other plugin it's all require_once as already mentioned.
You'd only be getting the find_replace_templatesets() error if require was being used, check again for any instances of require in your plugin files.
And if there's no require what so ever and all other plugins are using require_once ? I have already been over the plugins because it was the solution last time, but isn't working here.
Only plugins will ever include this file, and if it's trying to redefine the function, it has to be including the file more than once, which will not be happening if include_once/require_once is being used everywhere.

If you want, you can PM me FTP login details and I'll have a look through them later.
There are 4 that had include instead of require, which will have the same effect if it isn't told to only include it once. I've changed those to include_once, see if it works now.

To be honest I don't know why the default code doesn't include this file when activating/deactivating plugins, would make things a lot easier.
Pages: 1 2