Backend Development

Need PHP Help

Submitted by Deleted_3747, , Thread ID: 18650

Thread Closed
24-02-2016, 03:47 PM
#1
So i was installing Mysubscriptions for MyBB & i was going to add a usergroup thingy...

But i got this error, in this code...

Can anyone see what's wrong with the line 414?

[Image: a24d8f88bb500a302f6d5d3772332069.png]

[Image: 45c9397bcb2871d88db2c80fb6931ecf.png]


Here is the code for the whole usergroup php lines

PHP Code:
// $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
foreach($cache->cache['usergroups'] as $usergroup)
{
if(
intval($usergroup['gid']) != && !$usergroup['isbannedgroup'])
{
$usergroup_options[$usergroup['gid']] = $usergroup['title'];
}
}

if(isset(
$mybb->input['price_options']))
{
$forevs = array();
$others = array();
foreach(
$mybb->input['price_options'] as $_id => $opt)
{
if(empty(
$mybb->input['delete_price'][$_id]))
{
if(
intval($opt['l']) < 1$forevs[] = $opt;
else 
$others[] = $opt;
}
}
if(!empty(
$forevs))
{
$c = array();
foreach(
$forevs as $key => $val)
{
$c[$key] = $val['c'];
}
array_multisort($cSORT_ASC$forevs);
}
if(!empty(
$others))
{
$c $l $lt = array();
foreach(
$others as $key => $val)
{
$c[$key] = $val['c'];
$l[$key] = $val['l'];
$lt[$key] = $val['lt'];
}
array_multisort($ltSORT_ASC$lSORT_ASC$cSORT_ASC$others);
}
$mybb->input['price_options'] = array();
foreach(
$others as $a$mybb->input['price_options'][] = $a;
foreach(
$forevs as $a$mybb->input['price_options'][] = $a;
}

if(
$mybb->request_method == 'post')
{
if(!isset(
$mybb->input['add']))
{
$name $db->escape_string($mybb->input['name']);
if(empty(
$name) || rtrim($name) == ''$errors[] = $lang->error_empty_name;

$price $db->escape_string(serialize($mybb->input['price_options']));

$currency $db->escape_string($mybb->input['currency']);
if(!
in_array($currencyarray_keys($currency_options))) $errors[] = $lang->error_invalid_currency;

$new_group intval($mybb->input['new_group']);
if(!
in_array($new_grouparray_keys($usergroup_options))) $errors[] = $lang->error_invalid_group;

if(!empty(
$mybb->input['accepted_groups']))
{
foreach(
$mybb->input['accepted_groups'] as $group)
{
$gid intval($group['gid']);
if(
in_array($gidarray_keys($usergroup_options)))
{
$accepted[] = $gid;
}
}
}
$accepted = (empty($accepted) ? 'all' implode(','$accepted));

$item_name $db->escape_string($mybb->input['item_name']);
if(!
ctype_alnum($item_name) || count($item_name) > 127$errors[] = $lang->error_invalid_item_name

RE: Need PHP Help

#2
That's just a warning, you can choose to ignore that if you want.
Shouldn't stop the code from working, all it's doing is trying to access a string as if it were an array.
Strings are able to be treated as arrays of single characters in PHP anyway.

RE: Need PHP Help

OP
This post was last modified: 24-02-2016, 04:21 PM by Deleted_3747
#3
24-02-2016, 04:07 PM
LikeAlcohol Wrote:
That's just a warning, you can choose to ignore that if you want.
Shouldn't stop the code from working, all it's doing is trying to access a string as if it were an array.
Strings are able to be treated as arrays of single characters in PHP anyway.

But when i get the error & proceed anyways, it doesn't work to set what usergroup anyways, so it's stopping it from working & just de-select my option

SOLVED

Users browsing this thread: 2 Guest(s)