function cimy_show_options($results, $embedded) { global $wpdb, $wpdb_wp_fields_table, $wpdb_fields_table, $wpdb_data_table, $max_length_fieldset_value, $cimy_uef_name, $cimy_uef_url, $cimy_project_url, $cimy_uef_version, $cimy_uef_domain, $cimy_top_menu, $max_length_extra_fields_title, $cuef_upload_path, $cuef_plugin_dir; if (!cimy_check_admin('manage_options')) { return; } // save options engine if (isset($_POST['cimy_options']) && isset($cimy_top_menu)) { $results = cimy_save_options(); } $options = cimy_get_options(); wp_print_scripts("cimy_uef_upload_file"); $warning_msg = $wpdb->escape(__("Please upload an image with one of the following extensions", $cimy_uef_domain)); if ($options) { if (!is_dir($cuef_upload_path) && is_writable(WP_CONTENT_DIR)) { if (defined("FS_CHMOD_DIR")) { @mkdir($cuef_upload_path, FS_CHMOD_DIR); } else { @mkdir($cuef_upload_path, 0777); } } $options['fieldset_title'] = esc_attr($options['fieldset_title']); $welcome_email = $options['welcome_email']; isset($options['recaptcha_public_key']) ? $recaptcha_public_key = $options['recaptcha_public_key'] : ($recaptcha_public_key = ''); isset($options['recaptcha_private_key']) ? $recaptcha_private_key = $options['recaptcha_private_key'] : ($recaptcha_private_key = ''); $db_options = true; } else { $db_options = false; $options['fieldset_title'] = ""; $welcome_email = ''; $recaptcha_public_key = ''; $recaptcha_private_key = ''; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_wp_fields_table}'") == $wpdb_wp_fields_table) { $sql = "SELECT id, COUNT(*) FROM " . $wpdb_wp_fields_table . " GROUP BY id"; $db_wp_fields = $wpdb->query($sql); } else { $db_wp_fields = -1; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_fields_table}'") == $wpdb_fields_table) { $sql = "SELECT id, COUNT(*) FROM " . $wpdb_fields_table . " GROUP BY id"; $db_extra_fields = $wpdb->query($sql); } else { $db_extra_fields = -1; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb_data_table}'") == $wpdb_data_table) { $db_users_data = true; } else { $db_users_data = false; } $ret = array(); $ret['db_options'] = $db_options; $ret['db_extra_fields'] = $db_extra_fields; $ret['db_wp_fields'] = count($options['wp_hidden_fields']); $ret['db_users_data'] = $db_users_data; if (isset($cimy_top_menu) && $embedded) { return $ret; } $update_db_label = $wpdb->escape(__("This operation will create/update all missing tables/options, do you want to proceed?", $cimy_uef_domain)); ?> <div class="wrap" id="options"> <?php if (function_exists("screen_icon")) { screen_icon("options-general"); } ?> <h2><?php _e("Options"); if (!isset($cimy_top_menu)) { ?> - <a href="#addfield"><?php _e("Add a new Field", $cimy_uef_domain); ?> </a> - <a href="#extrafields"><?php _e("Extra Fields", $cimy_uef_domain); ?> </a><?php } ?> </h2> <table class="form-table"> <tr> <th scope="row" width="40%"> <strong><a href="<?php echo $cimy_project_url; ?> "><?php _e("Support the Cimy Project", $cimy_uef_domain); ?> </a></strong> </th> <td width="60%"> <form style="text-align: left;" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="8774924" /> <input alt="PayPal - The safer, easier way to pay online." name="submit" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/it_IT/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /> </form> <?php _e("This plug-in is the results of hours of development to add new features, support new WordPress versions and fix bugs, please donate money if saved you from spending all these hours!", $cimy_uef_domain); ?> </td> </tr> </table> <?php // print successes if there are some if (count($results) > 0) { ?> <div class="updated"> <h3><?php _e("SUCCESSFUL", $cimy_uef_domain); ?> </h3> <ul> <?php foreach ($results as $result) { echo "<li>" . $result . "</li>"; } ?> </ul> <br /> </div> <?php } ?> <form method="post" action="#options" id="cimy_uef_options"> <?php wp_nonce_field('cimy_uef_options', 'cimy_uef_optionsnonce', false); ?> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes'); ?> " /></p> <h3><?php _e("General"); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"> <strong><a href="<?php echo $cimy_uef_url; ?> "><?php echo $cimy_uef_name; ?> </a></strong> </th> <td width="60%">v<?php echo $options['version']; if ($cimy_uef_version != $options['version']) { ?> (<?php _e("installed is", $cimy_uef_domain); ?> v<?php echo $cimy_uef_version; ?> )<?php } if (!$db_options) { ?> <br /><h4><?php _e("OPTIONS DELETED!", $cimy_uef_domain); ?> </h4> <input type="hidden" name="do_not_save_options" value="1" /> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?> " onclick="return confirm('<?php echo $update_db_label; ?> ');" /></p><?php } else { if ($cimy_uef_version != $options['version']) { ?> <br /><h4><?php _e("VERSIONS MISMATCH! This because you haven't de-activated and re-activated the plug-in after the update! This could give problems...", $cimy_uef_domain); ?> </h4> <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?> " onclick="return confirm('<?php echo $update_db_label; ?> ');" /></p><?php } } ?> </td> </tr> <tr> <th scope="row"><?php _e("Picture/Avatar upload", $cimy_uef_domain); ?> </th> <td> <?php if (is_writable($cuef_upload_path)) { echo "<em>" . $cuef_upload_path . "</em><br />" . __("is created and writable", $cimy_uef_domain); } else { echo "<em>" . $cuef_upload_path . "</em><br />" . __("is NOT created or webserver does NOT have permission to write on it", $cimy_uef_domain); } ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="mail_include_fields" value="1"<?php checked(true, $options['mail_include_fields'], true); ?> /> <?php _e("Show all fields in the welcome email", $cimy_uef_domain); ?> </th> <td> <?php _e("the email sent to the admin and to the user upon registration will have all fields", $cimy_uef_domain); ?> </td> </tr> <?php if (!is_multisite()) { ?> <tr> <th scope="row"> <input type="checkbox" name="confirm_email" value="1"<?php checked(true, $options['confirm_email'], true); ?> /> <?php _e("Enable email confirmation", $cimy_uef_domain); ?> </th> <td> <?php _e("user that registers should confirm its email address via a link click", $cimy_uef_domain); echo "<br />"; _e("<strong>note:</strong> this option turned on will automatically disable (only during the registration) all upload fields: file, picture, avatar", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="confirm_form" value="1"<?php checked(true, $options['confirm_form'], true); ?> /> <?php _e("Enable form confirmation", $cimy_uef_domain); ?> </th> <td> <?php _e("a summary of the registration form will be presented to the user", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <?php _e("Customize welcome email sent to the new user", $cimy_uef_domain); ?> </th> <td> <textarea name="welcome_email" rows="6" cols="50"><?php echo esc_html($welcome_email); ?> </textarea><br /> <?php _e("if you change or remove the placeholders then the email won't have the correct information", $cimy_uef_domain); ?> </td> </tr> <tr> <th scope="row"> <input type="checkbox" name="redirect_to" value="source"<?php checked("source", $options['redirect_to'], true); ?> /> <?php _e("Redirect to the source", $cimy_uef_domain); ?> </th> <td> <?php _e("after the registration or confirmation the user will be redirected to the address where was exactly before clicking on the registration link", $cimy_uef_domain); ?> </td> </tr> <?php } ?> <tr> <th scope="row"> <input type="radio" name="captcha" value="none"<?php checked("none", $options['captcha'], true); ?> /> <?php _e('No captcha', $cimy_uef_domain); ?> </a> </th> <td> </td> </tr> <tr> <th scope="row"> <input type="radio" name="captcha" value="recaptcha"<?php checked("recaptcha", $options['captcha'], true); ?> /> <?php _e('Enable <a href="http://www.google.com/recaptcha" target="_blank">reCAPTCHA</a>', $cimy_uef_domain); ?> </a> </th> <td> <?php _e("Public KEY", $cimy_uef_domain); ?> <input type="text" name="recaptcha_public_key" value="<?php echo esc_attr($recaptcha_public_key); ?> " size="40" /><br /> <?php _e("Private KEY", $cimy_uef_domain); ?> <input type="text" name="recaptcha_private_key" value="<?php echo esc_attr($recaptcha_private_key); ?> " size="40" /> </td> </tr> <tr> <th scope="row"> <input type="radio" name="captcha" value="securimage"<?php checked("securimage", $options['captcha'], true); ?> /> <?php _e('Enable <a href="http://www.phpcaptcha.org/" target="_blank">Securimage Captcha</a>', $cimy_uef_domain); ?> </a> </th> <td> <?php _e('This captcha is probably weaker, but is easier for users', $cimy_uef_domain); ?> <?php if (!is_file($cuef_plugin_dir . '/securimage/securimage.php')) { echo "<br />"; printf(__('<strong>WARNING: to activate this captcha download <a href="http://www.phpcaptcha.org/latest.zip" target="_blank">this package</a> and unpack it under %s</strong>', $cimy_uef_domain), $cuef_plugin_dir . '/recaptcha/'); } ?> </td> </tr> <?php if (!is_multisite()) { ?> <tr> <th scope="row"><?php _e("Change login/registration page logo", $cimy_uef_domain); ?> </th> <td> <?php if (!empty($options["registration-logo"])) { ?> <input type="hidden" name="registration_logo_oldfile" value="<?php echo basename($options["registration-logo"]); ?> " /> <?php echo esc_html(basename($options["registration-logo"])) . '<br />'; ?> <input type="checkbox" name="registration_logo_del" value="1" /> <?php echo " " . __("Delete the picture", $cimy_uef_domain); ?> <br /><br /><?php } ?> <input type="file" id="registration_logo" name="registration_logo" onchange="uploadFile('cimy_uef_options', 'registration_logo', '<?php echo $warning_msg; ?> ', Array('gif', 'png', 'jpg', 'jpeg', 'tiff'))" /> <?php _e("Maximum recommended logo width is 328px, but any height should work.", $cimy_uef_domain); ?> </td> </tr> <?php } ?> </table> <br /> <h3><?php _e("Database", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><input type="checkbox" name="db_options_check" value="1" /> Cimy User Extra Fields <?php _e("Options"); ?> </th> <td width="60%"> <?php if ($db_options) { ?> <select name="db_options"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="default"><?php _e("Default values", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_wp_fields_check" value="1" /> <?php _e("WordPress Fields table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_wp_fields >= 0) { ?> <select name="db_wp_fields"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_extra_fields_check" value="1" /> <?php _e("Extra Fields table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_extra_fields >= 0) { ?> <select name="db_extra_fields"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select><?php } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="db_data_check" value="1" /> <?php _e("Users Data table", $cimy_uef_domain); ?> </th> <td> <?php if ($db_users_data) { ?> <select name="db_data"> <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option> <option value="empty"><?php _e("Empty", $cimy_uef_domain); ?> </option> <option value="delete"><?php _e("Delete"); ?> </option> </select> <?php _e("all data inserted by users in all and only extra fields", $cimy_uef_domain); } else { echo "<strong>" . __("NOT PRESENT", $cimy_uef_domain) . "</strong>"; } ?> </td> </tr> <tr> <th scope="row"><input type="checkbox" name="force_activation" value="1" /> <?php _e("Force tables creation", $cimy_uef_domain); ?> </th> <td> <?php _e("equivalent to de-activate and activate the plug-in; no other operation will be performed", $cimy_uef_domain); ?> </td> </tr> </table> <br /> <h3><?php _e("User Profile", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><?php _e("Extra Fields section title", $cimy_uef_domain); ?> </th> <td width="60%"><input type="text" name="extra_fields_title" value="<?php echo esc_attr($options['extra_fields_title']); ?> " size="35" maxlength="<?php echo $max_length_extra_fields_title; ?> " /></td> </tr> <tr> <th scope="row"><?php _e("Fieldset's titles, separates with comma", $cimy_uef_domain); ?> <br /><?php _e("example: title1,title2,title3", $cimy_uef_domain); ?> </th> <td><input type="text" name="fieldset_title" value="<?php echo esc_attr($options['fieldset_title']); ?> " size="35" maxlength="<?php echo $max_length_fieldset_value; ?> " /> <?php _e("<strong>note:</strong> if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again", $cimy_uef_domain); ?> </td> </tr> </table> <br /> <h3><?php _e("Authors & Users Extended", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"> <input type="checkbox" name="hide_username" value="1"<?php checked(true, in_array('username', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide username field", $cimy_uef_domain); ?> </th> <td width="60%"></td> </tr> <tr> <th> <input type="checkbox" name="hide_name" value="1"<?php checked(true, in_array('name', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide name field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_email" value="1"<?php checked(true, in_array('email', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide email field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_role" value="1"<?php checked(true, in_array('role', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide role field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="hide_website" value="1"<?php checked(true, in_array('website', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide website field", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="hide_posts" value="1"<?php checked(true, in_array('posts', $options['aue_hidden_fields']), true); ?> /> <?php _e("Hide n. posts field", $cimy_uef_domain); ?> </th> <td></td> </tr> </table> <br /> <h3><?php _e("WordPress hidden fields", $cimy_uef_domain); ?> </h3> <table class="form-table"> <tr> <th scope="row" width="40%"><input type="checkbox" name="show_wp_password" value="1"<?php checked(true, in_array('password', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show password", $cimy_uef_domain); ?> </th> <td width="60%"></td> </tr> <tr> <th> <input type="checkbox" name="show_wp_password2" value="1"<?php checked(true, in_array('password2', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show confirmation password", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th> <input type="checkbox" name="show_wp_password_meter" value="1"<?php checked(true, $options['password_meter'], true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show password strength meter", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_firstname" value="1"<?php checked(true, in_array('firstname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show first name", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_lastname" value="1"<?php checked(true, in_array('lastname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show last name", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th><input type="checkbox" name="show_wp_nickname" value="1"<?php checked(true, in_array('nickname', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show nickname", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_website" value="1"<?php checked(true, in_array('website', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show website", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_aim" value="1"<?php checked(true, in_array('aim', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show AIM", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_yahoo" value="1"<?php checked(true, in_array('yahoo', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Yahoo IM", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_jgt" value="1"<?php checked(true, in_array('jgt', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Jabber / Google Talk", $cimy_uef_domain); ?> </th> <td></td> </tr> <tr> <th scope="row"><input type="checkbox" name="show_wp_bio-info" value="1"<?php checked(true, in_array('bio-info', $options['wp_hidden_fields']), true); disabled(true, $db_wp_fields < 0, true); ?> /> <?php _e("Show Biographical Info", $cimy_uef_domain); ?> </th> <td></td> </tr> </table> <input type="hidden" name="cimy_options" value="1" /> <p class="submit"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes'); ?> " /></p> </form> </div> <br /> <?php return $ret; }
function cimy_admin_define_extra_fields() { global $wpdb, $wpdb_fields_table, $wpdb_wp_fields_table, $rule_canbeempty, $rule_email, $rule_maxlen, $rule_maxlen_needed, $available_types, $max_length_name, $max_length_label, $max_length_desc, $max_length_value, $max_size_file, $rule_equalto, $rule_equalto_case_sensitive, $cimy_uef_domain, $cuef_plugin_path, $cimy_uef_file_types, $rule_equalto_regex; if (!cimy_check_admin('manage_options')) { return; } // if (!empty($_POST)) // print_r($_POST); $errors = array(); $results = array(); $add_caption = __("Add field", $cimy_uef_domain); $edit_caption = __("Update field", $cimy_uef_domain); $del_caption = __("Delete field", $cimy_uef_domain); $delSel_caption = __("Delete selected fields", $cimy_uef_domain); $order_caption = __("Change order", $cimy_uef_domain); $submit_msgs = array(); $submit_msgs['add_caption'] = $add_caption; $submit_msgs['edit_caption'] = $edit_caption; $submit_msgs['del_caption'] = $del_caption; $submit_msgs['delSel_caption'] = $delSel_caption; $submit_msgs['order_caption'] = $order_caption; $min_length_caption = __("Min length", $cimy_uef_domain); $exact_length_caption = __("Exact length", $cimy_uef_domain); $max_length_caption = __("Max length", $cimy_uef_domain); $exact_or_max_length_capton = __("Exact or Max length", $cimy_uef_domain); $minLen = 1; $maxLen = $max_length_value; $submit = ""; $action = ""; // defaults to add $field_order = "0"; // options form engine if (isset($_POST['cimy_options'])) { $action = "options"; $res = cimy_save_options(); } else { if (isset($_POST["submit_add"]) && !empty($_POST["submit_add"])) { $action = "add"; $submit = $_POST["submit_add"]; } else { if (isset($_POST["submit_edit"]) && !empty($_POST["submit_edit"])) { $action = "edit"; $submit = $_POST["submit_edit"]; } else { if (isset($_POST["submit_del"]) && !empty($_POST["submit_del"])) { $action = "del"; $submit = $_POST["submit_del"]; } else { if (isset($_POST["submit_del_sel"]) && !empty($_POST["submit_del_sel"])) { $action = "delSel"; $submit = $_POST["submit_del_sel"]; } else { if (isset($_POST["submit_order"]) && !empty($_POST["submit_order"])) { $action = "order"; $submit = $_POST["submit_order"]; } } } } } } if (!isset($res)) { $res = array(); } // call options draw function $opt_ret = cimy_show_options($res, true); // needed fields count here, after options and before $action manager! do not move! $num_fields = $opt_ret['db_extra_fields']; $num_wp_fields = $opt_ret['db_wp_fields']; if (isset($_POST['wp_fields'])) { $wp_fields_post = true; $fields_table = $wpdb_wp_fields_table; $tot_fields = $num_wp_fields; } else { $wp_fields_post = false; $fields_table = $wpdb_fields_table; $tot_fields = $num_fields; } // if pushed change order button if ($action == "order") { $sql = "UPDATE " . $fields_table . " SET F_ORDER=CASE F_ORDER"; $k = -1; $msg = ""; $msg_new = ""; $arr1 = array(); $arr2 = array(); // check only selected fields foreach ($_POST['check'] as $i) { if ($k > -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 <table> SET F_ORDER=CASE F_ORDER WHEN <oldvalue1> THEN <newvalue1> [WHEN ... THEN ...] ELSE F_ORDER END WHERE F_ORDER IN(<oldvalue1> [, <oldvalue2>... ]) $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") { $field_order = key($submit); // 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] = $field_order; $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 <table> WHERE F_ORDER=<value1> [OR F_ORDER=<value2> ...] $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 <table> SET F_ORDER=CASE F_ORDER WHEN <oldvalue1> THEN <newvalue1> [WHEN ... THEN ...] ELSE F_ORDER END WHERE F_ORDER IN(<oldvalue1> [, <oldvalue2>...]) $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]; $fieldset = $_POST['fieldset'][$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 (in_array($type, $cimy_uef_file_types)) { $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]; $equalto_regex = $_POST['equalto_regex'][$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); $show_in_search = $_POST['show_in_search'][$field_order]; $show_in_search == "1" ? $store_rule['show_in_search'] = true : ($store_rule['show_in_search'] = false); $show_in_blog = $_POST['show_in_blog'][$field_order]; $show_in_blog == "1" ? $store_rule['show_in_blog'] = true : ($store_rule['show_in_blog'] = false); $show_level = $_POST['show_level'][$field_order]; $store_rule['show_level'] = $show_level; // 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 ($equalto_regex != "" && in_array($type, $rule_equalto_regex)) { $store_rule['equal_to_regex'] = true; } else { $store_rule['equal_to_regex'] = 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 (is_multisite()) { // uploading files not supported with WordPress MU if (in_array($type, $cimy_uef_file_types)) { $store_rule["show_in_reg"] = false; } } // 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; $data['fieldset'] = $fieldset; 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(); ?> <div class="wrap" id="addfield"> <h2><?php _e("Add a new Field", $cimy_uef_domain); ?> </h2> <?php // print errors if there are some cimy_uef_print_messages($errors, $results); if ($store_rule['min_length'] == 0) { unset($store_rule['min_length']); } if ($store_rule['exact_length'] == 0) { unset($store_rule['exact_length']); } if ($store_rule['max_length'] == 0) { unset($store_rule['max_length']); } // SHOW LEVEL $show_anonymous = ''; $show_subscriber = ''; $show_contributor = ''; $show_author = ''; $show_editor = ''; $show_admin = ''; if ($action == "add") { // CAN BE MODIFIED OR NOT $selected_input[$store_rule['edit']] = ' selected="selected"'; // NAME if ($name != "") { $selected_input["name"] = $name; } else { $selected_input["name"] = ''; } // LABEL if ($label != "") { $selected_input["label"] = $label; } else { $selected_input["label"] = ''; } // VALUE if ($value != "") { $selected_input["value"] = $value; } else { $selected_input["value"] = ''; } // DESCRIPTION if ($desc != "") { $selected_input["desc"] = $desc; } else { $selected_input["desc"] = ''; } // TYPE if ($type != "") { $selected_input[$type] = ' selected="selected"'; } else { $selected_input["text"] = ' selected="selected"'; } // MIN LEN if ($minlen != "") { $selected_input["minlen"] = ' checked="checked"'; } else { $selected_input["minlen"] = ''; } if (isset($store_rule['min_length'])) { $selected_input["min_length"] = $store_rule['min_length']; } else { $selected_input["min_length"] = ''; } // EXACT LEN if ($exactlen != "") { $selected_input["exactlen"] = ' checked="checked"'; } else { $selected_input["exactlen"] = ''; } if (isset($store_rule['exact_length'])) { $selected_input["exact_length"] = $store_rule['exact_length']; } else { $selected_input["exact_length"] = ''; } // MAX LEN if ($maxlen != "") { $selected_input["maxlen"] = ' checked="checked"'; } else { $selected_input["maxlen"] = ''; } if (isset($store_rule['max_length'])) { $selected_input["max_length"] = $store_rule['max_length']; } else { $selected_input["max_length"] = ''; } // EQUAL TO if (isset($equal)) { $selected_input["equal"] = ' checked="checked"'; } else { $selected_input["equal"] = ''; } if (isset($store_rule['equal_to'])) { $selected_input["equal_to"] = $store_rule['equal_to']; } else { $selected_input["equal_to"] = ''; } if (isset($equalto_casesens)) { $selected_input["equal_to_case_sensitive"] = ' checked="checked"'; } else { $selected_input["equal_to_case_sensitive"] = ''; } if (isset($equalto_regex)) { $selected_input["equal_to_regex"] = ' checked="checked"'; } else { $selected_input["equal_to_regex"] = ''; } // CHECK EMAIL SYNTAX if ($store_rule['email'] == true) { $selected_input["email"] = ' checked="checked"'; } else { $selected_input["email"] = ''; } // SHOW LEVEL switch ($store_rule['show_level']) { case '-1': $show_anonymous = ' selected="selected"'; break; case '0': $show_subscriber = ' selected="selected"'; break; case '1': $show_contributor = ' selected="selected"'; break; case '2': $show_author = ' selected="selected"'; break; case '5': $show_editor = ' selected="selected"'; break; case '8': $show_admin = ' selected="selected"'; break; } } else { $selected_input["ok_edit"] = ' selected="selected"'; $show_anonymous = ' selected="selected"'; } // CAN BE EMPTY if ($store_rule['can_be_empty'] == true || $action != "add") { $selected_input["empty"] = ' checked="checked"'; } else { $selected_input["empty"] = ''; } // SHOW IN REGISTRATION if (!isset($store_rule['show_in_reg']) || $store_rule['show_in_reg'] == true || $action != "add") { $selected_input["show_in_reg"] = ' checked="checked"'; } else { $selected_input["show_in_reg"] = ''; } // SHOW IN PROFILE if (!isset($store_rule['show_in_profile']) || $store_rule['show_in_profile'] == true || $action != "add") { $selected_input["show_in_profile"] = ' checked="checked"'; } else { $selected_input["show_in_profile"] = ''; } // SHOW IN AUTHORS AND USERS EXTENDED if (!isset($store_rule['show_in_aeu']) || $store_rule['show_in_aeu'] == true || $action != "add") { $selected_input["show_in_aeu"] = ' checked="checked"'; } else { $selected_input["show_in_aeu"] = ''; } // SHOW IN THE SEARCH if (!isset($store_rule['show_in_search']) || $store_rule['show_in_search'] == true || $action != "add") { $selected_input["show_in_search"] = ' checked="checked"'; } else { $selected_input["show_in_search"] = ''; } // SHOW IN THE BLOG if (!isset($store_rule['show_in_blog']) || $store_rule['show_in_blog'] == true || $action != "add") { $selected_input["show_in_blog"] = ' checked="checked"'; } else { $selected_input["show_in_blog"] = ''; } $selected_input["name"] = esc_attr($selected_input["name"]); $selected_input["value"] = esc_attr($selected_input["value"]); $selected_input["label"] = esc_attr($selected_input["label"]); $selected_input["desc"] = esc_attr($selected_input["desc"]); $selected_input["equal_to"] = esc_attr($selected_input["equal_to"]); ?> <form method="post" action="#addfield"> <p><?php _e("To add a new field you have to choose a name, type and label; optional are value and description. Rules are applied during user registration.", $cimy_uef_domain); ?> </p> <ul> <li><?php _e("With <strong>radio</strong> and <strong>checkbox</strong>: <em>Value</em> and <em>equal TO</em> can only be 'Yes' or 'No' that means 'selected' or 'not selected'", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>drop-down</strong>: you have to add all options into label for example: label/item1,item2,item3", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>picture</strong>: you can preload a default image putting url in <em>Value</em>; 'min,exact,max size' are in KB; <em>equal TO</em> means max pixel size (width or height) for thumbnail", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>picture-url</strong>: you can preload a default image putting url in <em>Value</em>; <em>equal TO</em> means max width pixel size (height will be proportional)", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>registration-date</strong>: <em>equal TO</em> means date and time format", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>avatar</strong>: you can preload a default image putting url in <em>Value</em>; 'min,exact,max size' are in KB; <em>equal TO</em> is automatically set to 512 pixels", $cimy_uef_domain); ?> </li> <li><?php _e("With <strong>file</strong>: you can preload a default file putting url in <em>Value</em>; 'min,exact,max size' are in KB; under <em>equal TO</em> can be specified allowed extensions separated by comma, example: zip,pdf,doc", $cimy_uef_domain); ?> </li> </ul> <br /> <table class="widefat" cellpadding="10"> <thead align="center"> <tr> <th><h3 style="text-align: center;"><?php _e("Name"); ?> - <?php _e("Value"); ?> </h3></th> <th><h3 style="text-align: center;"><?php _e("Type", $cimy_uef_domain); ?> </h3></th> <th><h3 style="text-align: center;"><?php _e("Label", $cimy_uef_domain); ?> - <?php _e("Description"); ?> </h3></th> <th><h3 style="text-align: center;"><?php _e("Rules", $cimy_uef_domain); ?> </h3></th> <th><h3 style="text-align: center;"><?php _e("Actions"); ?> </h3></th> </tr> </thead> <tbody id="plugins" class="plugins"> <tr class="active"> <td style="vertical-align: middle;"> <label><strong><?php _e("Name"); ?> </strong><br /><input name="name[0]" type="text" value="<?php echo $selected_input["name"]; ?> " maxlength="<?php echo $max_length_name; ?> " /></label><br /><br /> <label><strong><?php _e("Value"); ?> </strong><br /><textarea name="value[0]" rows="2" cols="17"><?php echo $selected_input["value"]; ?> </textarea></label> </td> <td style="vertical-align: middle;"> <label><strong><?php _e("Type", $cimy_uef_domain); ?> </strong><br /> <select name="type[0]"> <?php foreach ($available_types as $this_type) { echo '<option value="' . $this_type . '"' . $selected_input[$this_type] . '>' . $this_type . '</option>'; echo "\n"; if (isset($selected_input[$this_type])) { unset($selected_input[$this_type]); } } ?> </select> </label> <br /><br /> <label><strong><?php _e("Fieldset", $cimy_uef_domain); ?> </strong><br /> <?php echo cimy_fieldsetOptions($fieldset, "0"); ?> </label> </td> <td style="vertical-align: middle;"> <label><strong><?php _e("Label", $cimy_uef_domain); ?> </strong><br /><textarea name="label[0]" rows="2" cols="18"><?php echo $selected_input["label"]; ?> </textarea></label><br /><br /> <label><strong><?php _e("Description"); ?> </strong><br /><textarea name="description[0]" rows="4" cols="18"><?php echo $selected_input["desc"]; ?> </textarea></label> </td> <td style="vertical-align: middle;"> <!-- MIN LENGTH --> <input type="checkbox" name="minlen[0]" value="1"<?php echo $selected_input["minlen"]; ?> /> <?php echo $min_length_caption; ?> [1-<?php echo $maxLen; ?> ]: <input type="text" name="minlength[0]" value="<?php echo $selected_input["min_length"]; ?> " maxlength="5" size="5" /><br /> <!-- EXACT LENGTH --> <input type="checkbox" name="exactlen[0]" value="1"<?php echo $selected_input["exactlen"]; ?> /> <?php echo $exact_length_caption; ?> [1-<?php echo $maxLen; ?> ]: <input type="text" name="exactlength[0]" value="<?php echo $selected_input["exact_length"]; ?> " maxlength="5" size="5" /><br /> <!-- MAX LENGTH --> <input type="checkbox" name="maxlen[0]" value="1"<?php echo $selected_input["maxlen"]; ?> /> <?php echo $max_length_caption; ?> [1-<?php echo $maxLen; ?> ]: <input type="text" name="maxlength[0]" value="<?php echo $selected_input["max_length"]; ?> " maxlength="5" size="5" /><br /> <input type="checkbox" name="empty[0]" value="1"<?php echo $selected_input["empty"]; ?> /> <?php _e("Can be empty", $cimy_uef_domain); ?> <br /> <input type="checkbox" name="email[0]" value="1"<?php echo $selected_input["email"]; ?> /> <?php _e("Check for E-mail syntax", $cimy_uef_domain); ?> <br /> <select name="edit[0]"> <option value="ok_edit"<?php echo $selected_input["ok_edit"]; ?> ><?php _e("Can be modified", $cimy_uef_domain); ?> </option> <option value="edit_only_if_empty"<?php echo $selected_input["edit_only_if_empty"]; ?> ><?php _e("Can be modified only if empty", $cimy_uef_domain); ?> </option> <option value="edit_only_by_admin"<?php echo $selected_input["edit_only_by_admin"]; ?> ><?php _e("Can be modified only by admin", $cimy_uef_domain); ?> </option> <option value="edit_only_by_admin_or_if_empty"<?php echo $selected_input["edit_only_by_admin_or_if_empty"]; ?> ><?php _e("Can be modified only by admin or if empty", $cimy_uef_domain); ?> </option> <option value="no_edit"<?php echo $selected_input["no_edit"]; ?> ><?php _e("Cannot be modified", $cimy_uef_domain); ?> </option> <?php if (isset($selected_input[$edit])) { unset($selected_input[$edit]); } ?> </select> <br /> <!-- EQUAL TO --> <input type="checkbox" name="equal[0]" value="1"<?php echo $selected_input["equal"]; ?> /> <?php _e("Should be equal TO", $cimy_uef_domain); ?> : <input type="text" name="equalto[0]" maxlength="100" value="<?php echo $selected_input["equal_to"]; ?> "/><br /> <!-- CASE SENSITIVE --> <input type="checkbox" name="equalto_casesens[0]" value="1"<?php echo $selected_input["equal_to_case_sensitive"]; ?> /> <?php _e("Case sensitive", $cimy_uef_domain); ?> <br /> <!-- REGEX --> <input type="checkbox" name="equalto_regex[0]" value="1"<?php echo $selected_input["equal_to_regex"]; ?> /> <?php _e("Regular Expression", $cimy_uef_domain); ?> <br /> <!-- SHOW IN REGISTRATION --> <input type="checkbox" name="show_in_reg[0]" value="1"<?php echo $selected_input["show_in_reg"]; ?> /> <?php _e("Show the field in the registration", $cimy_uef_domain); ?> <br /> <!-- SHOW IN PROFILE --> <input type="checkbox" name="show_in_profile[0]" value="1"<?php echo $selected_input["show_in_profile"]; ?> /> <?php _e("Show the field in User's profile", $cimy_uef_domain); ?> <br /> <!-- SHOW IN A&U EXTENDED --> <input type="checkbox" name="show_in_aeu[0]" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in A&U Extended menu", $cimy_uef_domain); ?> <br /> <!-- SHOW IN THE SEARCH ENGINE --> <input type="checkbox" name="show_in_search[0]" value="1"<?php echo $selected_input["show_in_search"]; ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?> <br /> <!-- SHOW IN THE BLOG --> <input type="checkbox" name="show_in_blog[0]" value="1"<?php echo $selected_input["show_in_blog"]; ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?> <br /> <!-- SHOW SECURITY LEVEL --> <?php _e("Show the field if the role is at least:", $cimy_uef_domain) . " "; ?> <select name="show_level[0]"> <option value="-1"<?php echo $show_anonymous; ?> ><?php _e("Anonymous"); ?> </option> <option value="0"<?php echo $show_subscriber; ?> ><?php echo translate_user_role("Subscriber"); ?> </option> <option value="1"<?php echo $show_contributor; ?> ><?php echo translate_user_role("Contributor"); ?> </option> <option value="2"<?php echo $show_author; ?> ><?php echo translate_user_role("Author"); ?> </option> <option value="5"<?php echo $show_editor; ?> ><?php echo translate_user_role("Editor"); ?> </option> <option value="8"<?php echo $show_admin; ?> ><?php echo translate_user_role("Administrator"); ?> </option> </select> <br /> </td> <td align="center" style="vertical-align: middle;"> <p class="submit" style="border-width: 0px;"> <input name="reset" type="reset" value="<?php _e("Clear", $cimy_uef_domain); ?> " /><br /><br /> <input class="button-primary" name="submit_add[0]" type="submit" value="<?php echo $add_caption; ?> " /> </p> </td> </tr> </tbody> </table> <br /><br /> </form> </div> <script type="text/javascript"> <!--// function changeFormAction(form_id, tr_id) { var element = document.getElementById(form_id); element.action = '#'+tr_id; } //--> </script> <?php wp_print_scripts("cimy_uef_invert_sel"); $wp_fields = get_cimyFields(true); cimy_admin_show_extra_fields($wp_fields, $submit_msgs, true, $errors, $results, $wp_fields_post, $field_order); cimy_admin_show_extra_fields($allFields, $submit_msgs, false, $errors, $results, $wp_fields_post, $field_order); }