Hi
Apologies as I’m new to PHPVMS but I’m getting the following error message in the admin center and I’m not sure whats causing it…
Warning: Illegal string offset ‘group_add’ in /core/common/PilotData.class.php on line 359
Warning: Illegal string offset ‘group_remove’ in /core/common/PilotData.class.php on line 365
Im on phpVMS version 2.1.936 and here is the code below from /core/common/PilotData.class.php
Any help or support would be greatly appreciated!
/**
* Update a pilot, $params is an array of column_name=>value
*
* @param mixed $pilotid This is a description
* @param mixed $params This is a description
* @return mixed This is the return value description
*
*/
public static function updateProfile($pilotid, $params) {
/*$params = array(
‘pilotid’ => ‘’,
‘code’ => ‘’,
‘email’ => ‘’,
‘location’ => ‘’,
‘hub’ => ‘’,
‘bgimage’ => ‘’,
‘retired’ => false,
);
*/
if(empty($pilotid)) {
return false;
}
if (!is_array($params)) {
return false;
}
/* Cleanup any specific parameters */
if (isset($params[‘location’])) {
$params[‘location’] = strtoupper($params[‘location’]);
}
if (isset($params[‘pilotid’])) {
unset($params[‘pilotid’]);
}
$sql = "UPDATE " . TABLE_PREFIX . "pilots SET “;
$sql .= DB::build_update($params);
$sql .= " WHERE pilotid={$pilotid}”;
$res = DB::query($sql);
if (DB::errno() != 0) {
return false;
}
# Auto groups?
$groups = Config::get(‘PILOT_STATUS_TYPES’);
if(isset($params[‘retired’])) {
$info = $groups[$params[‘retired’]];
# Automatically add into these groups
if(is_array($info[‘group_add’]) && count($info[‘group_add’]) > 0) {
foreach($info[‘group_add’] as $group) {
PilotGroups::addUsertoGroup($pilotid, $group);
}
}
if(is_array($info[‘group_remove’]) && count($info[‘group_remove’]) > 0) {
foreach($info[‘group_remove’] as $group) {
PilotGroups::removeUserFromGroup($pilotid, $group);
}
}
}
return true;
}