MyBB Community Forums

Full Version: Parse error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
The value of $mybb->settings['Hello_Forum_Message'] will be the text inputted in the text box of the setting with the name Hello_Forum_Message.

Could you please paste your updated code?
<?php
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

define('MOD_NAME', 'Hello Forum!');
define('MOD_DESCRIPTION', 'Message');
define('MOD_VER', '1.0');
define('WEBSITE_MYBB', 'http://www.mybb.com');
define('MOD_AUTHOR', 'Twardy');
define('MOD_COMP', '1.6.8');
$MessageSystem = " ";

function HelloForum_info()
	{
        global $db;

	return array(
		"name"		    => MOD_NAME,
		"description"   => MOD_DESCRIPTION,
		"website"		=> WEBSITE_MYBB,
		"author"		=> MOD_AUTHOR,
		"authorsite"    => WEBSITE_MYBB,
		"version"		=> MOD_VER,
		"guid" 			=> "",
		"compatibility"	=> MOD_COMP,
		);
	}
	
function HelloForum_is_installed()
    {
     
	 echo $MessageSystem;
    }
	
function HelloForum_install()
{
	global $db;
	
	
    $settinggroup = array(
		"name" =>			MOD_NAME,
		"title" =>			MOD_NAME,
		"description" =>	MOD_DESCRIPTION,
	);
    $db->insert_query("setting", $HelloForumSetings);
	rebuild_settings();
	$gid = intval($db->insert_id());
	//Seting
    $setting[] = array(
		"name"			=> "Hello_Forum_Enable",
		"title"			=> "Hello Forum enable?",
		"optionscode"	=> "yesno",
		"value"			=> 1,
	);
$setting [] = array( "name" => "Hello_Forum_Message", "title" => "Enter Message to forum", "optionscode" => "text", "value" => 50, "disporder" => 1, );
function myfirstplugin_deactivate()
{
  global $db;
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('HelloForum_enable')");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='HelloForum'");
    rebuild_settings();
} 

$plugins->add_hook('global_start', 'Helloforum_global_start'); 

function HelloForum_global_start(){
  global $mybb;

  if ($mybb->settings['HelloForum_Enable'] == 1){
  echo $MessageSystem);
} 
}
?>
Line 72:
echo $MessageSystem);

Should be:
echo $MessageSystem;
Next error

Parse error: syntax
error, unexpected
$end in /virtual/
gamecreate.cba.pl/
inc/plugins/
HelloForum.php on
line 75
Paste your full code again.

edit: Nevermind. Add:

}

before:

?>
Parse error: syntax
error, unexpected
$end in /virtual/
gamecreate.cba.pl/
inc/plugins/
HelloForum.php on
line 74
You really should learn the PHP syntax if you're going to develop plugins.

http://php.net/manual/en/language.basic-syntax.php

Your code will continue to fail if you don't.
know to some extent PHP

Okay, I managed to make the plugin is activated but when it pops up

Fatal error: Call to a member function add_hook() on a non-object in /virtual/gamecreate.cba.pl/inc/plugins/HelloForum.php on line 66
Please post your updated code Smile
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

define('MOD_NAME', 'Hello Forum!');
define('MOD_DESCRIPTION', 'Message');
define('MOD_VER', '1.0');
define('WEBSITE_MYBB', 'http://www.mybb.com');
define('MOD_AUTHOR', 'Twardy');
define('MOD_COMP', '16*');
$MessageSystem = " ";

function HelloForum_info()
{
global $db;

return array(
"name" => MOD_NAME,
"description" => MOD_DESCRIPTION,
"website" => WEBSITE_MYBB,
"author" => MOD_AUTHOR,
"authorsite" => WEBSITE_MYBB,
"version" => MOD_VER,
"guid" => "",
"compatibility" => MOD_COMP,
);
}

function HelloForum_is_installed()
{

echo $MessageSystem;
}

function HelloForum_install()
{
global $db;


$settinggroup = array(
"name" => MOD_NAME,
"title" => MOD_NAME,
"description" => MOD_DESCRIPTION,
);
$db->insert_query("setting", $HelloForumSetings);
rebuild_settings();
$gid = intval($db->insert_id());
//Seting
$setting[] = array(
"name" => "Hello_Forum_Enable",
"title" => "Hello Forum enable?",
"optionscode" => "yesno",
"value" => 1,
);
$setting [] = array( "name" => "Hello_Forum_Message", "title" => "Enter Message to forum", "optionscode" => "text", "value" => 50, "disporder" => 1, );
function myfirstplugin_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name IN ('HelloForum_enable')");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='HelloForum'");
rebuild_settings();
}

$plugins->add_hook('global_start', 'HelloForum_global_start');

function HelloForum_global_start(){
global $mybb;

if ($mybb->settings['HelloForum_Enable'] == 1){
echo $MessageSystem;
}
}
}
?>
PS: How do I paste the code
from the PHP syntax color?
Pages: 1 2 3