if ($room->_db_getList('id', 'category_id IN ' . $member['moderated_categories'])) { foreach ($room->_db_list as $room_data) { $room_ids[] = $room_data['id']; } $room->_db_freeList(); } } // Get moderated rooms if (!empty($member['moderated_rooms']) && $room->_db_getList('id', 'id IN ' . $member['moderated_rooms'])) { foreach ($room->_db_list as $room_data) { $room_ids[] = $room_data['id']; } $room->_db_freeList(); } $room_ids = array_unique($room_ids); if (!empty($room_ids) && $room->_db_getList('name', 'id IN ' . implode(',', $room_ids), 'name ASC')) { foreach ($room->_db_list as $room_data) { $moderated_rooms[] = $room_data['name']; } $room->_db_freeList(); } } $member['moderated_category'] = $moderated_categories; $member['moderated_room'] = $moderated_rooms; if (!empty($load_custom_fields)) { $member['custom_field'] = $userdata->getUserData($member['id']); } $members_xml[] = $member; } } $xmlwriter->setData(array('total_members' => $total_members_count, 'page' => $page, 'total_pages' => $total_pages, 'member' => $members_xml));
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * Update user data. Following variables will be used (if set) * @param array $fields Array with field id as KEY and field value as VAL */ if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') { $profile_user_id = $current_user->id; } if (!empty($profile_user_id) && $current_user->_db_getList('id', 'id =# ' . $profile_user_id, 1) && !empty($custom_fields) && is_array($custom_fields)) { $current_user->_db_freeList(); _pcpin_loadClass('userdata'); $userdata = new PCPIN_UserData($session); // Get current userdata $userdata_current = $userdata->getUserData($profile_user_id); $new_fields = array(); foreach ($userdata_current as $val) { if (($val['writeable'] == 'user' || $current_user->is_admin === 'y') && array_key_exists($val['id'], $custom_fields)) { if ($val['type'] == 'multichoice') { // Check values for multichoice field $choices_allowed = "\n" . $val['choices'] . "\n"; $choices_new = $custom_fields[$val['id']] != '' ? explode("\n", $custom_fields[$val['id']]) : array(); $choices_checked = array(); foreach ($choices_new as $choice) { if (false !== strpos($choices_allowed, "\n" . $choice . "\n")) { $choices_checked[] = $choice; } } $custom_fields[$val['id']] = !empty($choices_checked) ? implode("\n", $choices_checked) : ''; } elseif ($val['type'] == 'choice') {