/**
  * Delete existing field
  * @param     int   $field_id     Field ID
  */
 function deleteField($field_id)
 {
     if (!empty($field_id) && $this->_db_getList('id', 'id =# ' . $field_id, 'custom = y', 1)) {
         $this->_db_freeList();
         if ($this->_db_deleteRow($field_id)) {
             // Delete field from all userdata records
             _pcpin_loadClass('userdata');
             $userdata = new PCPIN_UserData($this);
             $userdata->_db_deleteRow($field_id, 'field_id', true);
         }
     }
 }
 * @param   int       $sort_dir             Sort direction. Values: see $user->getMemberlist()
 * @param   int       $page_nr              Page number.
 * @param   boolean   $banned_only          Optional. If TRUE, then only banned users will be listed
 * @param   boolean   $muted_only           Optional. If TRUE, then only muted users will be listed
 * @param   boolean   $moderators_only      Optional. If TRUE, then only moderators will be listed
 * @param   boolean   $admins_only          Optional. If TRUE, then only admins will be listed
 * @param   boolean   $not_activated_only   Optional. If TRUE, then only not activated user accounts will be listed
 * @param   string    $user_ids             Optional. User IDs separated by comma
 * @param   int       $load_custom_fields   Optional. If not empty, custom profile fields will be loaded
 */
_pcpin_loadClass('room');
$room = new PCPIN_Room($session);
_pcpin_loadClass('category');
$category = new PCPIN_Category($session);
_pcpin_loadClass('userdata');
$userdata = new PCPIN_UserData($session);
if (!isset($nickname) || !is_scalar($nickname)) {
    $nickname = '';
}
if (!isset($sort_by) || !pcpin_ctype_digit($sort_by)) {
    $sort_by = 0;
}
if (!isset($sort_dir) || !pcpin_ctype_digit($sort_dir)) {
    $sort_dir = 0;
}
if (!isset($page) || !pcpin_ctype_digit($page)) {
    $page = 0;
}
if (!isset($banned_only) || $current_user->is_admin !== 'y') {
    $banned_only = false;
}
예제 #3
0
 /**
  * Delete user
  * @param   int   $user_id    User ID
  * @return  boolean   TRUE on success or FALSE on error
  */
 function deleteUser($user_id)
 {
     $result = false;
     if (!empty($user_id) && $this->_db_getList('id', 'id = ' . $user_id, 1)) {
         // Delete user
         if ($result = $this->_db_deleteRow($user_id)) {
             // Delete all avatars owned by user
             _pcpin_loadClass('avatar');
             $avatar = new PCPIN_Avatar($this);
             $avatar->deleteAvatar($user_id);
             // Delete all nicknames owned by user
             _pcpin_loadClass('nickname');
             $nickname = new PCPIN_Nickname($this);
             $nickname->deleteAllNickname($user_id);
             // Delete all messages sent TO this user
             _pcpin_loadClass('message');
             $message = new PCPIN_Message($this);
             if ($message->_db_getList('id', 'target_user_id = ' . $user_id)) {
                 $message_ids = array();
                 foreach ($message->_db_list as $data) {
                     $message_ids[] = $data['id'];
                 }
                 $message->_db_freeList();
                 $message->deleteMessages($message_ids);
             }
             // Delete userdata
             _pcpin_loadClass('userdata');
             $userdata = new PCPIN_UserData($this);
             $userdata->deleteUserData($user_id);
             // Update all users who ignored deleted user
             if ($res = $this->_db_query($this->_db_makeQuery(2050, $user_id))) {
                 $this->_db_freeResult($res);
             }
         }
     }
     return $result;
 }
 *    GNU General Public License for more details.
 *
 *    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;
                    }
                }