MyBB Community Forums

Full Version: Parse error: syntax error, unexpected 'mybb' (T_STRING)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using PageManager plugin and I've got some information that I only want to be shown for a couple of usergroups. 

<if $GLOBALS['mybb']->user['usergroup'] == 4 then>
code was here
</if>

I'm getting a Parse error. I wrapped the ' ' in / but it didn't fix it. I'm seeking assistance.

Here's my full code.

<?php
global $headerinclude, $header, $theme, $footer, $templates, $lang, $user, $usergroup;
$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}

<if $GLOBALS['mybb']->user['usergroup'] == 4 then>
Code removed
</if>

{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);

?>
This code works in PageManager Plugin: Wink
<?php
global $mybb, $headerinclude, $header, $footer;

if($mybb->user['usergroup'] == 4)
{
	$errors = 'Code Removed';
}

$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}
{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);
?>
Globalize $mybb.
(2017-03-02, 02:21 PM)SvePu Wrote: [ -> ]This code works in PageManager Plugin: Wink
<?php
global $mybb, $headerinclude, $header, $footer;

if($mybb->user['usergroup'] == 4)
{
	$errors = 'Code Removed';
}

$template = '<html>
<head>
<title>' . $pages['name'] . '</title>
{$headerinclude}
</head>
<body>
{$header}
{$errors}
{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"" . $template . "\";");

output_page($page);
?>

Hi ,thanks for your reply.

I added
if($mybb->user['usergroup'] == 4)
along with the two brackets but the page didn't like that at all. 
Parse error: syntax error, unexpected 'usergroup' (T_STRING)

if($mybb->user['usergroup'] == 4)

{
<table cellspacing="70%" cellpadding="46px" class="tborder tfixed" style="border:none;">

</tr>
<tr>
<td class="trow1">
<img src="images/misc/tableimageone.png" alt="Logo" height="60" width="60" style="float:left;"></img><span style="font-size:24px;color:#fff;margin-left:5px;"><a href="urlhere">Option One</a></span></br><span style="margin-left:5px;font-weight:bold;">Description.</span><span style="float:right;"><i class="fa fa-folder" aria-hidden="true" title="This is Operational"></i></span>
</td>
</tr>
</table>
}
</if>