(-1)) { $msg.= ", "; $msg_new.= ", "; } else $k = $i; $sql.= " WHEN ".$i." THEN ".$_POST['order'.$i]; $msg.= $i; $msg_new.= $_POST['order'.$i]; array_push($arr1, $i); array_push($arr2, $_POST['order'.$i]); } if ($k > (-1)) { if (count(array_diff($arr1, $arr2)) == 0) { $sql.= " ELSE F_ORDER END WHERE F_ORDER IN (".$msg.")"; // $sql WILL BE: UPDATE SET F_ORDER=CASE F_ORDER WHEN THEN [WHEN ... THEN ...] ELSE F_ORDER END WHERE F_ORDER IN( [, ... ]) $wpdb->query($sql); $results['order'] = __("Fields", $cimy_uef_domain)." #".$msg." ".__("changed to", $cimy_uef_domain)." #".$msg_new; } else $errors['order'] = __("You cannot give an order that misses some numbers", $cimy_uef_domain); } else $errors['order'] = __("Nothing selected", $cimy_uef_domain); } // if pushed delete or update single button if (($action == "del") || ($action == "edit")) { $from = strpos($submit, '#') + 1; $field_order = substr($submit, $from); // if pushed the single delete button then check the relative checkbox and let delSel code to delete it if ($action == "del") { $_POST['check'.$field_order] = 1; $action = "delSel"; } } if ($action == "delSel") { $sql = "DELETE FROM ".$fields_table." WHERE "; $sql_data_del = ""; $k = (-1); $j = (-1); $msg = ""; $not_del_old = ""; $not_del_sql = ""; // check which fields are selected for deletions for ($i = 1; $i <= $tot_fields; $i++) if ($_POST['check'.$i]) { if ($k > (-1)) { $sql.= " OR "; $sql_data_del.= " OR "; $msg.= ", "; } else { $k = $i; $j = $i; } $sql_data_del.= "FIELD_ID=".$i; $sql.= "F_ORDER=".$i; $msg.= $i; } else // field to NOT be deleted, but order probably have to change, if j==(-1) then order is ok because deletions is after it! if ($j > (-1)) { if ($not_del_old != "") { $not_del_old.= ", "; } $not_del_sql.= " WHEN ".$i." THEN ".$j." "; $not_del_old.= $i; $j++; } // if at least one field was selected if ($k > (-1)) { // $sql WILL BE: DELETE FROM
WHERE F_ORDER= [OR F_ORDER= ...] $wpdb->query($sql); // delete also all data inserted by users in this/these field/s cimy_delete_users_info($sql_data_del); if ($not_del_sql != "") { $not_del_sql = "UPDATE ".$fields_table." SET F_ORDER=CASE F_ORDER".$not_del_sql."ELSE F_ORDER END WHERE F_ORDER IN(".$not_del_old.")"; // $not_del_sql WILL BE: UPDATE
SET F_ORDER=CASE F_ORDER WHEN THEN [WHEN ... THEN ...] ELSE F_ORDER END WHERE F_ORDER IN( [, ...]) $wpdb->query($not_del_sql); } $results['delete'] = __("Field(s)", $cimy_uef_domain)." #".$msg." ".__("deleted correctly", $cimy_uef_domain); } else $errors['delete'] = __("Nothing selected", $cimy_uef_domain); } if (($action == "add") || ($action == "edit")) { $store_rule = array(); // RETRIEVE DATA FROM THE FORM $name = substr(stripslashes($_POST['name'.$field_order]), 0, $max_length_name); $value = substr(stripslashes($_POST['value'.$field_order]), 0, $max_length_value); $desc = substr(stripslashes($_POST['description'.$field_order]), 0, $max_length_desc); $label = substr(stripslashes($_POST['label'.$field_order]), 0, $max_length_label); $name = strtoupper($name); $oldname = strtoupper(stripslashes($_POST['oldname'.$field_order])); $type = $_POST['type'.$field_order]; $minlen = $_POST['minlen'.$field_order]; $exactlen = $_POST['exactlen'.$field_order]; $maxlen = $_POST['maxlen'.$field_order]; // min length available $minLen = 1; // max length or size for picture available if ($type == "picture") { $maxLen = $max_size_file; /* overwrite previous values */ $min_length_caption = __("Min size", $cimy_uef_domain)." (KB)"; $exact_length_caption = __("Exact size", $cimy_uef_domain)." (KB)"; $max_length_caption = __("Max size", $cimy_uef_domain)." (KB)"; $exact_or_max_length_capton = __("Exact or Max size", $cimy_uef_domain)." (KB)"; } else $maxLen = $max_length_value; /* end overwrite previous values */ if ($minlen != "") $store_rule['min_length'] = intval($_POST['minlength'.$field_order]); if ($exactlen != "") $store_rule['exact_length'] = intval($_POST['exactlength'.$field_order]); if ($maxlen != "") $store_rule['max_length'] = intval($_POST['maxlength'.$field_order]); $empty = $_POST['empty'.$field_order]; $empty == "1" ? $store_rule['can_be_empty'] = true : $store_rule['can_be_empty'] = false; $store_rule['edit'] = $_POST['edit'.$field_order]; $email = $_POST['email'.$field_order]; $email == "1" ? $store_rule['email'] = true : $store_rule['email'] = false; $equal = $_POST['equal'.$field_order]; if ($equal != "") { $store_rule['equal_to'] = stripslashes($_POST['equalto'.$field_order]); $equalto_casesens = $_POST['equalto_casesens'.$field_order]; } $show_in_reg = $_POST['show_in_reg'.$field_order]; $show_in_reg == "1" ? $store_rule['show_in_reg'] = true : $store_rule['show_in_reg'] = false; $show_in_profile = $_POST['show_in_profile'.$field_order]; $show_in_profile == "1" ? $store_rule['show_in_profile'] = true : $store_rule['show_in_profile'] = false; $show_in_aeu = $_POST['show_in_aeu'.$field_order]; $show_in_aeu == "1" ? $store_rule['show_in_aeu'] = true : $store_rule['show_in_aeu'] = false; // START CHECKING FOR ERRORS if ($name == "") $errors['name'] = __("Name not specified", $cimy_uef_domain); else if (!stristr($name, " ") === false) $errors['name'] = __("Name cannot contains spaces", $cimy_uef_domain); if ($label == "") $errors['label'] = __("Label not specified", $cimy_uef_domain); // max or exact length rule is needed for this type if (in_array($type, $rule_maxlen_needed)) { if (($maxlen == "") && ($exactlen == "")) $errors['maxlength1'] = $exact_or_max_length_capton." ".__("not selected (with this type is necessary)", $cimy_uef_domain); } // max or exact length rule is not needed but it's available for this type if (in_array($type, $rule_maxlen)) { if ((($maxlen != "") || ($minlen != "")) && ($exactlen != "")) $errors['exactlength1'] = __("If you select", $cimy_uef_domain)." ".$exact_length_caption." ".__("you cannot select Min or Max", $cimy_uef_domain); // MIN LEN if ($minlen != "") if (($store_rule['min_length'] < $minLen) || ($store_rule['min_length'] > $maxLen)) $errors['minlength3'] = $min_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen; // EXACT LEN if ($exactlen != "") if (($store_rule['exact_length'] < $minLen) || ($store_rule['exact_length'] > $maxLen)) $errors['exactlength3'] = $exact_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen; // MAX LEN if ($maxlen != "") if (($store_rule['max_length'] < $minLen) || ($store_rule['max_length'] > $maxLen)) $errors['maxlength3'] = $max_length_caption." ".__("should be in the range of", $cimy_uef_domain)." ".$minLen. "-".$maxLen; } else { $minlen = ""; $exactlen = ""; $maxlen = ""; } if ($equal != "") { if (!isset($store_rule['equal_to'])) $errors['equalTo'] = __("Equal TO not specified", $cimy_uef_domain); else if ($store_rule['equal_to'] == "") $errors['equalTo'] = __("Equal TO not specified", $cimy_uef_domain); else if ((strtoupper($store_rule['equal_to']) != "YES") && (strtoupper($store_rule['equal_to']) != "NO")) { if ($type == "checkbox") $errors['equalTo2'] = __("With checkbox type Equal TO can only be", $cimy_uef_domain).": [Yes, No]"; if ($type == "radio") $errors['equalTo2'] = __("With radio type Equal TO can only be", $cimy_uef_domain).": [Yes, No]"; } if (($equalto_casesens != "") && (in_array($type, $rule_equalto_case_sensitive))) $store_rule['equal_to_case_sensitive'] = true; else $store_rule['equal_to_case_sensitive'] = false; } if (($value != "") && (strtoupper($value) != "YES") && (strtoupper($value) != "NO")) { if ($type == "checkbox") $errors['value'] = __("With checkbox type Value can only be", $cimy_uef_domain).": [Yes, No]"; if ($type == "radio") $errors['value'] = __("With radio type Value can only be", $cimy_uef_domain).": [Yes, No]"; } // IF THERE ARE NO ERRORS THEN GO ON if (count($errors) == 0) { $exist = array(); if ($type != "radio") { $sql1 = "SELECT id FROM ".$fields_table." WHERE name='".$wpdb->escape($name)."' LIMIT 1"; $exist = $wpdb->get_row($sql1); } // SEARCH THE NAME IN THE DATABASE, GO ON ONLY IF DURING EDIT IT WAS THE SAME FIELD if ((count($exist) == 0) || (($action == "edit") && ($oldname == $name))) { // MIN LEN if (!in_array($type, $rule_maxlen)) unset($store_rule['min_length']); // EXACT LEN if (!in_array($type, $rule_maxlen)) unset($store_rule['exact_length']); // MAX LEN if (!in_array($type, $rule_maxlen)) unset($store_rule['max_length']); if (!in_array($type, $rule_email)) $store_rule['email'] = false; if (!in_array($type, $rule_canbeempty)) $store_rule['can_be_empty'] = true; if (($type == "checkbox") || ($type == "radio")) $value = strtoupper($value); $data = array(); $data['name'] = $name; $data['value'] = $value; $data['desc'] = $desc; $data['label'] = $label; $data['type'] = $type; $data['store_rule'] = $store_rule; $data['field_order'] = $field_order; $data['num_fields'] = $num_fields; cimy_save_field($action, $fields_table, $data); if ($action == "add") $results['inserted'] = __("Field inserted correctly", $cimy_uef_domain); else if ($action == "edit") $results['edit'] = __("Field #", $cimy_uef_domain).$field_order." ".__("updated correctly", $cimy_uef_domain); } else { $errors['namedup'] = __("Name inserted is just in the database, change to another one", $cimy_uef_domain); } } } // if extra fields table is not present if ($num_fields == -1) exit; // do NOT move this line, it's here because should shows also fields just added to the database $allFields = get_cimyFields(); ?>

0) { ?>

    ".$error.""; ?>

0) { ?>

    ".$result.""; ?>

  • radio and checkbox: Value and equal TO can only be 'Yes' or 'No' that means 'selected' or 'not selected'", $cimy_uef_domain); ?>
  • drop-down: you have to add all options into label for example: label/item1,item2,item3", $cimy_uef_domain); ?>
  • picture: you can preload a default image putting url in Value; 'min,exact,max size' are in KB; equal TO means max pixel size (width or height) for thumbnail", $cimy_uef_domain); ?>
  • picture-url: you can preload a default image putting url in Value; equal TO means max width pixel size (height will be proportional)", $cimy_uef_domain); ?>
  • registration-date: equal TO means date and time format", $cimy_uef_domain); ?>

-

-





/> [1-]:    " maxlength="5" size="5" />
/> [1-]: " maxlength="5" size="5" />
/> [1-]:   " maxlength="5" size="5" />
/>
/>

/> : "/>
     />
/>
/>
/>
" />



'; if (count($allFields) == 0) _e("None!", $cimy_uef_domain); else { ?> " onclick="this.value=invert_sel('', 'check', '')" /> ');" />

- -

-









/> [1-]:     />
/> [1-]: />
/> [1-]:    />
/>
/>

/> : />
     />
/>
/>
/>
" />

" />

" onclick="return confirm('');" />

get_col("SELECT ID FROM $wpdb->users;"); foreach ($userids as $userid) { $tmp_user = new WP_User($userid); $roles = $tmp_user->roles; $role = array_shift($roles); $roleclasses[$role][$tmp_user->user_login] = $tmp_user; } ?>

$roleclass) { ksort($roleclass); ?> '.__("Username").''; } if (!in_array("name", $options['aue_hidden_fields'])) { echo ''; } if (!in_array("email", $options['aue_hidden_fields'])) { echo ''; } if (!in_array("website", $options['aue_hidden_fields'])) { echo ''; } if (!in_array("posts", $options['aue_hidden_fields'])) { echo ''; } if (!in_array("actions", $options['aue_hidden_fields'])) { echo ''; } $i = 0; if (count($extra_fields) > 0) foreach ($extra_fields as $thisField) { $rules = $thisField['RULES']; if ($rules['show_in_aeu']) { /*if (in_array($i, $admin_menu_new_row)) { echo ""; }*/ $i++; $label = $thisField['LABEL']; if ($thisField['TYPE'] == "dropdown") { $ret = cimy_dropDownOptions($label, $value); $label = $ret['label']; } echo ""; } } ?> user_email; $url = $user_object->user_url; $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; $numposts = get_usernumposts( $user_object->ID ); if (0 < $numposts) $numposts = "$numposts"; echo " "; if (!in_array("username", $options['aue_hidden_fields'])) { echo ""; } if (!in_array("name", $options['aue_hidden_fields'])) { echo ""; } if (!in_array("email", $options['aue_hidden_fields'])) { echo ""; } if (!in_array("website", $options['aue_hidden_fields'])) { echo ""; } if (!in_array("posts", $options['aue_hidden_fields'])) { echo ""; } if (!in_array("actions", $options['aue_hidden_fields'])) { echo "'; } // if user has not yet fields in the data table then create them if (count($extra_fields) > 0) foreach ($extra_fields as $thisField) { $field_id = $thisField['ID']; cimy_insert_ExtraFields_if_not_exist($user_object->ID, $field_id); } $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$user_object->ID, ARRAY_A); $i = 0; // print all the content of extra fields if there are some if (count($extra_fields) > 0) foreach ($extra_fields as $thisField) { $rules = $thisField['RULES']; $type = $thisField['TYPE']; $value = $thisField['VALUE']; if ($rules['show_in_aeu']) { $field_id = $thisField['ID']; /*if (in_array($i, $admin_menu_new_row)) { echo ""; }*/ foreach ($ef_db as $d_field) if ($d_field['FIELD_ID'] == $field_id) $field = $d_field['VALUE']; echo ""; } $i++; } echo ''; } } ?>

role_names[$role]; ?>

'.__("Name").''.__("E-mail").''.__("Website").''.__("Posts").''.__("Actions").'
".$label."
$email$short_url$numposts"; if (current_user_can('edit_users')) echo "".__('Edit').""; echo '
"; if ($type == "picture-url") { if ($field == "") $field = $value; if ($field != "") { if (intval($rules['equal_to'])) { echo ''; echo 'picture'; echo ""; } else { echo 'picture'; } echo "
"; echo "\n\t\t"; } } else if ($type == "picture") { if ($field == "") $field = $value; if ($field != "") { //$profileuser = get_user_to_edit($user_object->ID); //$user_login = $profileuser->user_login; $user_login = $user_object->user_login; $value_thumb = cimy_get_thumb_path($field); $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($field)); echo "\n\t\t"; if (is_file($file_thumb)) { echo 'picture
'; echo "\n\t\t"; } else { echo 'picture
'; echo "\n\t\t"; } } } else if ($type == "registration-date") { if (isset($rules['equal_to'])) $registration_date = cimy_get_formatted_date($field, $rules['equal_to']); else $registration_date = cimy_get_formatted_date($field); echo $registration_date; } else echo $field; //if ($i == 0 || in_array($i, $admin_menu_new_row)) echo " "."
escape($data['name']); $value = $wpdb->escape($data['value']); $desc = $wpdb->escape($data['desc']); if ($wp_fields) $label = $wpdb->escape(__($data['label'])); else $label = $wpdb->escape($data['label']); $type = $wpdb->escape($data['type']); $store_rule = $wpdb->escape(serialize($data['store_rule'])); $field_order = $wpdb->escape($data['field_order']); $num_fields = $wpdb->escape($data['num_fields']); if ($action == "add") $sql = "INSERT INTO ".$table." "; else if ($action == "edit") $sql = "UPDATE ".$table." "; $sql.= "SET name='".$name."', value='".$value."', description='".$desc."', label='".$label."', type='".$type."', rules='".$store_rule."'"; if ($action == "add") $sql.= ", F_ORDER=".($num_fields + 1); else if ($action == "edit") $sql.= " WHERE F_ORDER=".$field_order; $wpdb->query($sql); } ?>