Cimy User Extra Fields - Version 2.0.3

Version Description

Download this release

Release Info

Developer Cimmo
Plugin Icon wp plugin Cimy User Extra Fields
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

README_OFFICIAL.txt CHANGED
@@ -569,6 +569,13 @@ A lot of times I cannot reproduce the problem and I need more details, so if you
569
 
570
 
571
  CHANGELOG:
 
 
 
 
 
 
 
572
  v2.0.2 - 05/02/2011
573
  - Fixed for some WordPress MS unique installations DB table definitions were wrongly set (thanks to Yuri)
574
  - Fixed registration date now works for all registered users, regardless when the field has been added
569
 
570
 
571
  CHANGELOG:
572
+ v2.0.3 - 15/03/2011
573
+ - Fixed A&U Extended page permissions to "list_users" instead of "edit_users" (thanks to Matt)
574
+ - Fixed pre value for checkbox, radio, dropdown and dropdown-multi fields (thanks to Matt)
575
+ - Fixed fields can be modified in some ways even if set to not to (thanks to Matt)
576
+ - Fixed rules were applied anyway when adding new user from user-new.php (introduced with a change in WP 3.1) (thanks to Matt)
577
+ - Fixed Fatal error: Cannot redeclare wp_load_image() on MS installations (thanks to jcraig)
578
+
579
  v2.0.2 - 05/02/2011
580
  - Fixed for some WordPress MS unique installations DB table definitions were wrongly set (thanks to Yuri)
581
  - Fixed registration date now works for all registered users, regardless when the field has been added
cimy_uef_admin.php CHANGED
@@ -1248,7 +1248,7 @@ function cimy_uef_print_messages($errors, $results) {
1248
  function cimy_admin_users_list_page() {
1249
  global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain, $cimy_uef_file_types;
1250
 
1251
- if (!cimy_check_admin('edit_users'))
1252
  return;
1253
 
1254
  $options = cimy_get_options();
@@ -1830,7 +1830,7 @@ function cimy_admin_users_list_page() {
1830
  echo $field;
1831
 
1832
  echo "</div>";
1833
- if ((!in_array($type, $cimy_uef_file_types)) && ($type != "radio") && ($type != "registration-date"))
1834
  echo "[<a href=\"#\" onclick=\"editExtraField(".$user_object->ID.", '".$name."'); return false;\">".__("Change")."</a>]";
1835
 
1836
  echo "&nbsp;</span></td>";
1248
  function cimy_admin_users_list_page() {
1249
  global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain, $cimy_uef_file_types;
1250
 
1251
+ if (!cimy_check_admin('list_users'))
1252
  return;
1253
 
1254
  $options = cimy_get_options();
1830
  echo $field;
1831
 
1832
  echo "</div>";
1833
+ if ((!in_array($type, $cimy_uef_file_types)) && ($type != "radio") && ($type != "registration-date") && (current_user_can('edit_user', $user_object->ID)))
1834
  echo "[<a href=\"#\" onclick=\"editExtraField(".$user_object->ID.", '".$name."'); return false;\">".__("Change")."</a>]";
1835
 
1836
  echo "&nbsp;</span></td>";
cimy_uef_functions.php CHANGED
@@ -500,4 +500,17 @@ function cimy_get_registration_date($user_id, $value) {
500
  return "";
501
  }
502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  ?>
500
  return "";
501
  }
502
 
503
+ function cimy_uef_is_field_disabled($type, $edit_rule, $old_value) {
504
+ global $rule_cannot_be_empty;
505
+
506
+ if (($edit_rule == 'no_edit')
507
+ || (($edit_rule == 'edit_only_if_empty') && (in_array($type, $rule_cannot_be_empty)) && (!empty($old_value)))
508
+ || (($edit_rule == 'edit_only_by_admin') && (!current_user_can('edit_users')))
509
+ || (($edit_rule == 'edit_only_by_admin_or_if_empty') && (!current_user_can('edit_users')))
510
+ || (($edit_rule == 'edit_only_by_admin_or_if_empty') && (in_array($type, $rule_cannot_be_empty)) && (!empty($old_value))))
511
+ return true;
512
+
513
+ return false;
514
+ }
515
+
516
  ?>
cimy_uef_profile.php CHANGED
@@ -49,7 +49,7 @@ function cimy_extract_ExtraFields() {
49
  // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A);
50
 
51
  $radio_checked = array();
52
-
53
  $current_fieldset = -1;
54
  $tiny_mce_objects = "";
55
 
@@ -93,10 +93,13 @@ function cimy_extract_ExtraFields() {
93
  // }
94
  $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id));
95
  $old_value = $value;
96
-
 
 
 
97
  // if nothing is inserted and field admin default value then assign it
98
  if (in_array($type, $rule_profile_value)) {
99
- if ($value == "")
100
  $value = $thisField['VALUE'];
101
  }
102
 
@@ -142,10 +145,7 @@ function cimy_extract_ExtraFields() {
142
  $obj_closing_tag = false;
143
  $obj_style = ' class="regular-text"';
144
 
145
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
146
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
147
- || ($rules['edit'] == 'no_edit')
148
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
149
  $obj_disabled = ' disabled="disabled"';
150
  else
151
  $obj_disabled = "";
@@ -163,10 +163,7 @@ function cimy_extract_ExtraFields() {
163
  $obj_closing_tag = true;
164
  $obj_style = "";
165
 
166
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
167
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
168
- || ($rules['edit'] == 'no_edit')
169
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
170
  $obj_disabled = ' disabled="disabled"';
171
  else
172
  $obj_disabled = "";
@@ -189,10 +186,7 @@ function cimy_extract_ExtraFields() {
189
  $obj_closing_tag = true;
190
  $obj_style = "";
191
 
192
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
193
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
194
- || ($rules['edit'] == 'no_edit')
195
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
196
  $obj_disabled = ' disabled="disabled"';
197
  else
198
  $obj_disabled = "";
@@ -223,10 +217,7 @@ function cimy_extract_ExtraFields() {
223
  $obj_tag = "select";
224
  $obj_closing_tag = true;
225
 
226
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
227
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
228
- || ($rules['edit'] == 'no_edit')
229
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
230
  $obj_disabled = ' disabled="disabled"';
231
  else
232
  $obj_disabled = "";
@@ -244,8 +235,7 @@ function cimy_extract_ExtraFields() {
244
  $obj_closing_tag = false;
245
  $obj_style = ' style="width:auto; border:0; background:white;"';
246
 
247
- if (($rules['edit'] == 'no_edit')
248
- || ((($rules['edit'] == 'edit_only_by_admin') || ($rules['edit'] == 'edit_only_by_admin_or_if_empty')) && (!current_user_can('edit_users'))))
249
  $obj_disabled = ' disabled="disabled"';
250
  else
251
  $obj_disabled = "";
@@ -262,16 +252,17 @@ function cimy_extract_ExtraFields() {
262
  $obj_closing_tag = false;
263
  $obj_style = ' style="width:auto; border:0; background:white;"';
264
 
265
- if (($rules['edit'] == 'no_edit')
266
- || ((($rules['edit'] == 'edit_only_by_admin') || ($rules['edit'] == 'edit_only_by_admin_or_if_empty')) && (!current_user_can('edit_users'))))
267
  $obj_disabled = ' disabled="disabled"';
268
  else
269
  $obj_disabled = "";
270
 
271
- if ($value == "")
272
- $obj_checked = '';
 
 
273
  else
274
- $obj_checked.= ' checked="checked"';
275
 
276
  break;
277
 
@@ -308,10 +299,7 @@ function cimy_extract_ExtraFields() {
308
  $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$fields_name_prefix.$field_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
309
  }
310
 
311
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
312
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
313
- || (($rules['edit'] == 'no_edit'))
314
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
315
  $obj_disabled = ' disabled="disabled"';
316
  else
317
  $obj_disabled = "";
@@ -414,7 +402,7 @@ function cimy_extract_ExtraFields() {
414
  }
415
 
416
  // if there is no image or there is the default one then disable delete button
417
- if ($old_value == "") {
418
  $dis_delete_img = ' disabled="disabled"';
419
  }
420
  // else if there is an image and it's not the default one
@@ -440,7 +428,7 @@ function cimy_extract_ExtraFields() {
440
  }
441
 
442
  if ($type == "picture-url") {
443
- if ($value != "") {
444
  if (intval($rules['equal_to'])) {
445
  echo '<a target="_blank" href="'.$value.'">';
446
  echo '<img src="'.$value.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
@@ -544,6 +532,8 @@ function cimy_update_ExtraFields() {
544
  }
545
 
546
  $prev_value = $wpdb->escape(stripslashes($_POST[$input_name."_".$field_id."_prev_value"]));
 
 
547
 
548
  if ((isset($_POST[$input_name])) && (!in_array($type, $cimy_uef_file_types))) {
549
  if ($type == "dropdown-multi")
@@ -642,43 +632,39 @@ function cimy_update_ExtraFields() {
642
  // if can be editable then write NO
643
  // there is no way to understand if was YES or NO previously
644
  // without adding other hidden inputs so write always
645
- if (($rules['edit'] == "ok_edit") || (($rules['edit'] == 'edit_only_by_admin') && (current_user_can('edit_users')))) {
646
- if ($i > 0)
647
- $field_ids.= ", ";
648
- else
649
- $i = 1;
650
-
651
- $field_ids.= $field_id;
652
 
653
- $field_value = "NO";
654
- $value = "'".$field_value."'";
655
- $prev_value = $prev_value == "YES" ? "'YES'" : "'NO'";
656
 
657
- $query.= " WHEN ".$field_id." THEN ";
658
- $query.= $value;
659
- }
 
 
 
660
  }
661
 
662
  if ($type == 'dropdown-multi') {
663
  // if can be editable then write ''
664
  // there is no way to understand if was YES or NO previously
665
  // without adding other hidden inputs so write always
666
- if (($rules['edit'] == "ok_edit") || (($rules['edit'] == 'edit_only_by_admin') && (current_user_can('edit_users')))) {
667
- if ($i > 0)
668
- $field_ids.= ", ";
669
- else
670
- $i = 1;
671
-
672
- $field_ids.= $field_id;
673
 
674
- $field_value = '';
675
- $value = "'".$field_value."'";
676
- $prev_value = "'".$prev_value."'";
677
- $ret = cimy_dropDownOptions($label, $field_value);
678
- $label = $ret['label'];
679
- $query.= " WHEN ".$field_id." THEN ";
680
- $query.= $value;
681
- }
 
682
  }
683
  }
684
  if (($rules["email_admin"]) && ($value != $prev_value) && ($type != "registration-date")) {
49
  // $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$get_user_id, ARRAY_A);
50
 
51
  $radio_checked = array();
52
+ $upload_file_function = false;
53
  $current_fieldset = -1;
54
  $tiny_mce_objects = "";
55
 
93
  // }
94
  $value = $wpdb->get_var($wpdb->prepare("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id));
95
  $old_value = $value;
96
+
97
+ if (($type == "radio") && (empty($radio_checked[$name])))
98
+ $radio_checked[$name] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ".$wpdb_data_table." WHERE USER_ID=".$get_user_id." AND FIELD_ID=".$field_id." AND VALUE=\"selected\""));
99
+
100
  // if nothing is inserted and field admin default value then assign it
101
  if (in_array($type, $rule_profile_value)) {
102
+ if (empty($value))
103
  $value = $thisField['VALUE'];
104
  }
105
 
145
  $obj_closing_tag = false;
146
  $obj_style = ' class="regular-text"';
147
 
148
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
 
 
149
  $obj_disabled = ' disabled="disabled"';
150
  else
151
  $obj_disabled = "";
163
  $obj_closing_tag = true;
164
  $obj_style = "";
165
 
166
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
 
 
167
  $obj_disabled = ' disabled="disabled"';
168
  else
169
  $obj_disabled = "";
186
  $obj_closing_tag = true;
187
  $obj_style = "";
188
 
189
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
 
 
190
  $obj_disabled = ' disabled="disabled"';
191
  else
192
  $obj_disabled = "";
217
  $obj_tag = "select";
218
  $obj_closing_tag = true;
219
 
220
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
 
 
221
  $obj_disabled = ' disabled="disabled"';
222
  else
223
  $obj_disabled = "";
235
  $obj_closing_tag = false;
236
  $obj_style = ' style="width:auto; border:0; background:white;"';
237
 
238
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
239
  $obj_disabled = ' disabled="disabled"';
240
  else
241
  $obj_disabled = "";
252
  $obj_closing_tag = false;
253
  $obj_style = ' style="width:auto; border:0; background:white;"';
254
 
255
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
256
  $obj_disabled = ' disabled="disabled"';
257
  else
258
  $obj_disabled = "";
259
 
260
+ if (($value == "selected") || (($value == "YES") && ($radio_checked[$name] == 0))) {
261
+ $radio_checked[$name] = 1;
262
+ $obj_checked = ' checked="checked"';
263
+ }
264
  else
265
+ $obj_checked = '';
266
 
267
  break;
268
 
299
  $obj_style = ' onchange="uploadFile(\'your-profile\', \''.$fields_name_prefix.$field_id.'\', \''.$warning_msg.'\', Array(\'gif\', \'png\', \'jpg\', \'jpeg\', \'tiff\'));"';
300
  }
301
 
302
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $old_value))
 
 
 
303
  $obj_disabled = ' disabled="disabled"';
304
  else
305
  $obj_disabled = "";
402
  }
403
 
404
  // if there is no image or there is the default one then disable delete button
405
+ if (empty($old_value)) {
406
  $dis_delete_img = ' disabled="disabled"';
407
  }
408
  // else if there is an image and it's not the default one
428
  }
429
 
430
  if ($type == "picture-url") {
431
+ if (!empty($value)) {
432
  if (intval($rules['equal_to'])) {
433
  echo '<a target="_blank" href="'.$value.'">';
434
  echo '<img src="'.$value.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
532
  }
533
 
534
  $prev_value = $wpdb->escape(stripslashes($_POST[$input_name."_".$field_id."_prev_value"]));
535
+ if (cimy_uef_is_field_disabled($type, $rules['edit'], $prev_value))
536
+ continue;
537
 
538
  if ((isset($_POST[$input_name])) && (!in_array($type, $cimy_uef_file_types))) {
539
  if ($type == "dropdown-multi")
632
  // if can be editable then write NO
633
  // there is no way to understand if was YES or NO previously
634
  // without adding other hidden inputs so write always
635
+ if ($i > 0)
636
+ $field_ids.= ", ";
637
+ else
638
+ $i = 1;
 
 
 
639
 
640
+ $field_ids.= $field_id;
 
 
641
 
642
+ $field_value = "NO";
643
+ $value = "'".$field_value."'";
644
+ $prev_value = $prev_value == "YES" ? "'YES'" : "'NO'";
645
+
646
+ $query.= " WHEN ".$field_id." THEN ";
647
+ $query.= $value;
648
  }
649
 
650
  if ($type == 'dropdown-multi') {
651
  // if can be editable then write ''
652
  // there is no way to understand if was YES or NO previously
653
  // without adding other hidden inputs so write always
654
+ if ($i > 0)
655
+ $field_ids.= ", ";
656
+ else
657
+ $i = 1;
 
 
 
658
 
659
+ $field_ids.= $field_id;
660
+
661
+ $field_value = '';
662
+ $value = "'".$field_value."'";
663
+ $prev_value = "'".$prev_value."'";
664
+ $ret = cimy_dropDownOptions($label, $field_value);
665
+ $label = $ret['label'];
666
+ $query.= " WHEN ".$field_id." THEN ";
667
+ $query.= $value;
668
  }
669
  }
670
  if (($rules["email_admin"]) && ($value != $prev_value) && ($type != "registration-date")) {
cimy_uef_register.php CHANGED
@@ -76,8 +76,8 @@ function cimy_register_user_extra_fields($user_id, $password="", $meta=array())
76
  if (isset($meta["blog_id"]))
77
  cimy_switch_to_blog($meta);
78
 
79
- // avoid to save stuff if user is being added from: /wp-admin/user-new.php
80
- if ($_POST["action"] == "adduser")
81
  return;
82
 
83
  $my_user_level = $user_level;
@@ -275,8 +275,8 @@ function cimy_registration_check($user_login, $user_email, $errors) {
275
  if ((!is_multisite()) && ($options["confirm_email"])) {
276
  $errors = cimy_check_user_on_signups($errors, $user_login, $user_email);
277
  }
278
- // avoid to save stuff if user is being added from: /wp-admin/user-new.php
279
- if ($_POST["action"] == "adduser")
280
  return $errors;
281
 
282
  $my_user_level = $user_level;
76
  if (isset($meta["blog_id"]))
77
  cimy_switch_to_blog($meta);
78
 
79
+ // avoid to save stuff if user is being added from: /wp-admin/user-new.php and shit WP 3.1 changed the value just to create new bugs :@
80
+ if (($_POST["action"] == "adduser") || ($_POST["action"] == "createuser"))
81
  return;
82
 
83
  $my_user_level = $user_level;
275
  if ((!is_multisite()) && ($options["confirm_email"])) {
276
  $errors = cimy_check_user_on_signups($errors, $user_login, $user_email);
277
  }
278
+ // avoid to save stuff if user is being added from: /wp-admin/user-new.php and shit WP 3.1 changed the value just to create new bugs :@
279
+ if (($_POST["action"] == "adduser") || ($_POST["action"] == "createuser"))
280
  return $errors;
281
 
282
  $my_user_level = $user_level;
cimy_user_extra_fields.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cimy User Extra Fields
4
  Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Plugin Description: Add some useful fields to registration and user's info
6
- Version: 2.0.2
7
  Author: Marco Cimmino
8
  Author URI: mailto:cimmino.marco@gmail.com
9
  */
@@ -189,7 +189,7 @@ require_once($cuef_plugin_dir.'/cimy_uef_options.php');
189
  require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
190
 
191
  $cimy_uef_name = "Cimy User Extra Fields";
192
- $cimy_uef_version = "2.0.2";
193
  $cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
194
  $cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
195
 
@@ -433,8 +433,11 @@ $rule_maxlen_needed = array("text", "password", "picture", "picture-url", "avata
433
  // types that can have 'check for email syntax' rule
434
  $rule_email = array("text", "textarea", "textarea-rich", "password");
435
 
 
 
 
436
  // types that can admit a default value if empty
437
- $rule_profile_value = array("text", "textarea", "textarea-rich", "password", "picture", "picture-url", "avatar", "file");
438
 
439
  // types that can have 'equal to' rule
440
  $rule_equalto = array("text", "textarea", "textarea-rich", "password", "checkbox", "radio", "dropdown", "dropdown-multi", "picture", "picture-url", "registration-date", "file");
@@ -448,7 +451,7 @@ $rule_equalto_regex = array("text", "textarea", "textarea-rich", "password", "d
448
  // types that are file to be uploaded
449
  $cimy_uef_file_types = array("picture", "avatar", "file");
450
 
451
- // type that are textarea and needs rows and cols attributes
452
  $cimy_uef_textarea_types = array("textarea", "textarea-rich");
453
 
454
  $max_length_name = 20;
@@ -741,26 +744,25 @@ function cimy_uef_i18n_setup() {
741
 
742
  function cimy_admin_menu_custom() {
743
  global $cimy_uef_name, $cimy_uef_domain, $cimy_top_menu, $cimy_uef_plugins_dir;
744
-
745
- if (!cimy_check_admin('manage_options'))
746
- return;
747
-
748
  if (isset($cimy_top_menu) && (!is_multisite())) {
749
  add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Options"), "UEF: ".__("Options"), 'manage_options', "user_extra_fields_options", 'cimy_show_options_notembedded');
750
  add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Fields", $cimy_uef_domain), "UEF: ".__("Fields", $cimy_uef_domain), 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
751
- $aue_page = add_submenu_page('profile.php', __('Authors &amp; Users Extended', $cimy_uef_domain), __('A&amp;U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
752
  }
753
  else {
754
  if ((is_multisite()) && ($cimy_uef_plugins_dir == "mu-plugins")) {
755
- $aue_page = add_submenu_page('wpmu-admin.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'manage_options', "users_extended", 'cimy_admin_users_list_page');
756
  add_submenu_page('wpmu-admin.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
757
  }
758
  else {
759
  add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
760
- $aue_page = add_submenu_page('profile.php', __('Authors &amp; Users Extended', $cimy_uef_domain), __('A&amp;U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
761
  }
762
  }
763
- add_action('admin_print_scripts-'.$aue_page, 'cimy_uef_admin_ajax_edit');
 
764
  }
765
 
766
  function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="") {
@@ -913,7 +915,7 @@ function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $
913
  if (!function_exists("image_resize"))
914
  require_once(ABSPATH . 'wp-includes/media.php');
915
 
916
- if (!function_exists(wp_load_image))
917
  require_once($cuef_plugin_dir.'/cimy_uef_missing_functions.php');
918
 
919
  image_resize($file_full_path, $maxside, $maxside, false, "thumbnail");
3
  Plugin Name: Cimy User Extra Fields
4
  Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Plugin Description: Add some useful fields to registration and user's info
6
+ Version: 2.0.3
7
  Author: Marco Cimmino
8
  Author URI: mailto:cimmino.marco@gmail.com
9
  */
189
  require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
190
 
191
  $cimy_uef_name = "Cimy User Extra Fields";
192
+ $cimy_uef_version = "2.0.3";
193
  $cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
194
  $cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
195
 
433
  // types that can have 'check for email syntax' rule
434
  $rule_email = array("text", "textarea", "textarea-rich", "password");
435
 
436
+ // types that can have cannot be empty rule
437
+ $rule_cannot_be_empty = array("text", "textarea", "textarea-rich", "password", "dropdown", "dropdown-multi", "picture", "picture-url", "registration-date", "avatar", "file");
438
+
439
  // types that can admit a default value if empty
440
+ $rule_profile_value = array("text", "textarea", "textarea-rich", "password", "picture", "picture-url", "avatar", "file", "checkbox", "radio", "dropdown", "dropdown-multi");
441
 
442
  // types that can have 'equal to' rule
443
  $rule_equalto = array("text", "textarea", "textarea-rich", "password", "checkbox", "radio", "dropdown", "dropdown-multi", "picture", "picture-url", "registration-date", "file");
451
  // types that are file to be uploaded
452
  $cimy_uef_file_types = array("picture", "avatar", "file");
453
 
454
+ // types that are textarea and needs rows and cols attributes
455
  $cimy_uef_textarea_types = array("textarea", "textarea-rich");
456
 
457
  $max_length_name = 20;
744
 
745
  function cimy_admin_menu_custom() {
746
  global $cimy_uef_name, $cimy_uef_domain, $cimy_top_menu, $cimy_uef_plugins_dir;
747
+
748
+ $aue_page = "";
 
 
749
  if (isset($cimy_top_menu) && (!is_multisite())) {
750
  add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Options"), "UEF: ".__("Options"), 'manage_options', "user_extra_fields_options", 'cimy_show_options_notembedded');
751
  add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Fields", $cimy_uef_domain), "UEF: ".__("Fields", $cimy_uef_domain), 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
752
+ $aue_page = add_submenu_page('profile.php', __('Authors &amp; Users Extended', $cimy_uef_domain), __('A&amp;U Extended', $cimy_uef_domain), 'list_users', "au_extended", 'cimy_admin_users_list_page');
753
  }
754
  else {
755
  if ((is_multisite()) && ($cimy_uef_plugins_dir == "mu-plugins")) {
756
+ $aue_page = add_submenu_page('wpmu-admin.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'list_users', "users_extended", 'cimy_admin_users_list_page');
757
  add_submenu_page('wpmu-admin.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
758
  }
759
  else {
760
  add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
761
+ $aue_page = add_submenu_page('profile.php', __('Authors &amp; Users Extended', $cimy_uef_domain), __('A&amp;U Extended', $cimy_uef_domain), 'list_users', "au_extended", 'cimy_admin_users_list_page');
762
  }
763
  }
764
+ if (!empty($aue_page))
765
+ add_action('admin_print_scripts-'.$aue_page, 'cimy_uef_admin_ajax_edit');
766
  }
767
 
768
  function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="") {
915
  if (!function_exists("image_resize"))
916
  require_once(ABSPATH . 'wp-includes/media.php');
917
 
918
+ if (!function_exists("wp_load_image"))
919
  require_once($cuef_plugin_dir.'/cimy_uef_missing_functions.php');
920
 
921
  image_resize($file_full_path, $maxside, $maxside, false, "thumbnail");
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy
4
  Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar, recaptcha, captcha
6
  Requires at least: 3.0
7
- Tested up to: 3.0
8
- Stable tag: 2.0.2
9
 
10
  Add some useful fields to registration and user's info
11
 
4
  Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
5
  Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar, recaptcha, captcha
6
  Requires at least: 3.0
7
+ Tested up to: 3.1
8
+ Stable tag: 2.0.3
9
 
10
  Add some useful fields to registration and user's info
11