Example #1
0
     if ($search != '' && !empty($_REQUEST['profile_field'])) {
         $profile_fields = explode(",", $_REQUEST['profile_field']);
         if ($_REQUEST['profile_field_search_loc'] == "start") {
             $search_operator = '?*';
         } else {
             if ($_REQUEST['profile_field_search_loc'] == "end") {
                 $search_operator = '*?';
             } else {
                 $search_operator = '*';
             }
         }
         foreach ($profile_fields as $profile_field) {
             $profile_field_search_values[] = $search;
             $profile_field_search_operators[] = $search_operator;
         }
         $db_matching_users = phorum_api_user_search_custom_profile_field($profile_fields, $profile_field_search_values, $profile_field_search_operators, TRUE, 'OR');
         if (empty($db_matching_users)) {
             $db_matching_users = array();
         }
         $search_fields[] = 'user_id';
         $search_values[] = $db_matching_users;
         $search_operators[] = '()';
     }
 }
 if (isset($_REQUEST['search_type']) && $_REQUEST['search_type'] != '') {
     if ($_REQUEST['search_type'] == 'user') {
         $search_fields[] = 'admin';
         $search_values[] = 0;
         $search_operators[] = '=';
     } elseif ($_REQUEST['search_type'] == 'admin') {
         $search_fields[] = 'admin';
Example #2
0
<?php

require_once './include/api/custom_profile_fields.php';
// Find out if we have an active real_name custom user profile field.
$field = phorum_api_custom_profile_field_byname('real_name');
if (empty($field) || !empty($field['deleted'])) {
    return;
}
// If we do, then copy all available real_names to the new real_name
// field in the user table.
$ids = phorum_api_user_search_custom_profile_field($field['id'], '', '*', TRUE);
if (!empty($ids)) {
    foreach ($ids as $id) {
        $user = phorum_api_user_get($id);
        phorum_api_user_save_raw(array("user_id" => $id, "real_name" => $user["real_name"]));
    }
}
// Now we can delete the existing real_name field.
phorum_api_custom_profile_field_delete($real_name_field_id, TRUE);