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
I was doing a plugin and I got
in the end to try to test the
well and when I go in the
plugins tab gives me an error

Parse error: syntax
error, unexpected
T_FUNCTION in /
virtual/
gamecreate.cba.pl/
inc/plugins/
HelloForum.php on
line 15


Line 15:

[spoiler]
function Hello_Forum_info()[/spoiler]

All code:
[spoiler]<?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/2.0.0');
$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",<=$MessageSystem);
"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['Hello_Forum_Enable'] == 1){
echo $MessageSystem);
}
}
?>
[/spoiler]
Help me
You missed a semi-colon on line 13:

$MessageSystem = " "

Should be:
$MessageSystem = " ";

Edit: Also noticed you've missed several semi-colons.

For example line 17:
global $db

Should be:
global $db;

Line 34:
echo $MessageSystem

Should be:
echo $MessageSystem;
Parse error: syntax
error, unexpected
T_RETURN,
expecting ',' or ';' in
/virtual/
gamecreate.cba.pl/
inc/plugins/
HelloForum.php on
line 19

Help
I've updated my previous post. Smile
You shouldn't add 2.0.0 to the version compatibility because your plugin won't work on MyBB 2.0.
Error of the line19 is still
help me

Next error

Parse error: syntax error,
unexpected
T_IS_SMALLER_OR_EQUAL,
expecting ')' in /virtual/
gamecreate.cba.pl/inc/
plugins/HelloForum.php
on line 60

Refresh
Not too sure what you're trying to do here:

"optionscode"	=> "text",<=$MessageSystem);

Could you explain please? Smile
I wanted to get it to a variable
text typed by the admin to use
this note to echo how to do it
differently
$setting[] = array(
"name"	 => "Hello_Forum_Message",
"title"	 => "Enter Message to forum",
"optionscode"	=> "text",<=$MessageSystem);
"value"	 => 50,
"disporder" => 1,

Should be:
$setting[] = array(
"name"	 => "Hello_Forum_Message",
"title"	 => "Enter Message to forum",
"optionscode"	=> "text",
"value"	 => 50,
"disporder" => 1,
);

So you just want to take the input of that setting and echo it out? If so, you'd use something like this:

function HelloForum_global_start(){
global $mybb;

if ($mybb->settings['Hello_Forum_Enable'] == 1){
echo $mybb->settings['Hello_Forum_Message'];
}
}
'm not sure we're talking
about the same. Is this code in
the message display what I type
in the administrator
optionscode or what types of
text options?

Next problem

Parse error: syntax
error, unexpected ')',
expecting ',' or ';' in
/virtual/
gamecreate.cba.pl/
inc/plugins/
HelloForum.php on
line 72
Pages: 1 2 3