Backend Development
Need PHP Help
Submitted by Deleted_3747, 24-02-2016, 03:47 PM, 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?
Here is the code for the whole usergroup php lines
But i got this error, in this code...
Can anyone see what's wrong with the line 414?
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']) != 1 && !$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($c, SORT_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($lt, SORT_ASC, $l, SORT_ASC, $c, SORT_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($currency, array_keys($currency_options))) $errors[] = $lang->error_invalid_currency;
$new_group = intval($mybb->input['new_group']);
if(!in_array($new_group, array_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($gid, array_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
24-02-2016, 04:07 PM
#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.
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
24-02-2016, 04:07 PMLikeAlcohol 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: 1 Guest(s)