Cimy User Extra Fields - Version 2.2.0

Version Description

Download this release

Release Info

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

Code changes from version 2.1.1 to 2.2.0

README_OFFICIAL.txt CHANGED
@@ -53,8 +53,8 @@ WordPress and WordPress MultiSite per-blog registration:
53
  2. "Settings -> Cimy User Extra Fields" - lets administrators add as many new fields as are needed to the users' profile, giving the possibility to set some interesting rules.
54
 
55
  Wordpress MultiSite unique registration:
56
- 1. "Super Admin -> Users Extended" - lets you show users lists with the new fields that are created
57
- 2. "Super Admin -> Cimy User Extra Fields" - lets administrators add as many new fields as are needed to the users' profile, giving the possibility to set some interesting rules.
58
 
59
  Rules are:
60
 
@@ -104,8 +104,8 @@ Bugs or suggestions can be mailed at: cimmino.marco@gmail.com
104
 
105
  REQUIREMENTS:
106
  * PHP >= 5.0.0
107
- * WORDPRESS >= 3.0.x
108
- * WORDPRESS MultiSite >= 3.0.x
109
  * MYSQL >= 4.1.2
110
 
111
  INSTALLATION:
@@ -119,7 +119,7 @@ If you want that ALL Blogs on your MultiSite installation follow the same regist
119
  Every blog will have shared registration page and only the Super Admin can change it.
120
  - unpack the package under 'wp-content/mu-plugins' directory (if this directory does not exist, create it);
121
  - be sure that cimy_user_extra_fields.php is outside Cimy folder (move it if necessary);
122
- - go to "Super Admin -> Cimy User Extra Fields", press "Fix the problem" button and confirm.
123
 
124
  2) Per-Blog registration
125
  If you want that every single Blog can define its own Extra Fields then you should choose this installation.
@@ -523,7 +523,9 @@ do_action('register_post');
523
  Q1: I got "Fatal error: Allowed memory size of 8388608 bytes exhausted [..]", why?
524
  Q2: I got blank pages after activating this plug-in, why?
525
 
526
- A: Because your memory limit is too low, to fix it edit your php.ini and search memory_limit key and put at least to 12M
 
 
527
 
528
 
529
  Q: Your plug-in is great, but when you will add support to add more than one choice in radio and dropdown fields?
@@ -604,6 +606,21 @@ A lot of times I cannot reproduce the problem and I need more details, so if you
604
 
605
 
606
  CHANGELOG:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  v2.1.1 - 11/07/2011
608
  - Fixed compatibility with Theme My Login plug-in (introduced with v2.1.0) (thanks to Michele and Mark)
609
  - Fixed compatibility with WP-reCAPTCHA plug-in (thanks to des for the patch)
53
  2. "Settings -> Cimy User Extra Fields" - lets administrators add as many new fields as are needed to the users' profile, giving the possibility to set some interesting rules.
54
 
55
  Wordpress MultiSite unique registration:
56
+ 1. "Network Admin -> Users Extended" - lets you show users lists with the new fields that are created
57
+ 2. "Network Admin -> Cimy User Extra Fields" - lets administrators add as many new fields as are needed to the users' profile, giving the possibility to set some interesting rules.
58
 
59
  Rules are:
60
 
104
 
105
  REQUIREMENTS:
106
  * PHP >= 5.0.0
107
+ * WORDPRESS >= 3.1.x
108
+ * WORDPRESS MultiSite >= 3.1.x
109
  * MYSQL >= 4.1.2
110
 
111
  INSTALLATION:
119
  Every blog will have shared registration page and only the Super Admin can change it.
120
  - unpack the package under 'wp-content/mu-plugins' directory (if this directory does not exist, create it);
121
  - be sure that cimy_user_extra_fields.php is outside Cimy folder (move it if necessary);
122
+ - go to "Network Admin -> Cimy User Extra Fields", press "Fix the problem" button and confirm.
123
 
124
  2) Per-Blog registration
125
  If you want that every single Blog can define its own Extra Fields then you should choose this installation.
523
  Q1: I got "Fatal error: Allowed memory size of 8388608 bytes exhausted [..]", why?
524
  Q2: I got blank pages after activating this plug-in, why?
525
 
526
+ A1: Because your memory limit is too low, to fix it edit your php.ini and search memory_limit key and put at least to 12M
527
+ A2: If you do not have access to your php.ini you can try this workaround (might not work)
528
+ http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
529
 
530
 
531
  Q: Your plug-in is great, but when you will add support to add more than one choice in radio and dropdown fields?
606
 
607
 
608
  CHANGELOG:
609
+ v2.2.0 - 04/09/2011
610
+ - Added textarea and textarea-rich class in the profile area (thanks to Evaluator)
611
+ - Added case sensitive check for regex equalTo rules (thanks to Juliette for the patch)
612
+ - Fixed WordPress MS unique installation was broken since WP 3.1 (thanks to RaSo0l)
613
+ - Fixed CSS file inclusion, should fix RTL admin layout mess (thanks to Moti Nisim)
614
+ - Fixed extra slash present into image uris (thanks to zyrq)
615
+ - Fixed dropdown selection when illegal characters are present (introduced with v2.0.5) (thanks to Jared)
616
+ - Fixed some URLs still were not caring about https when used
617
+ - Fixed captcha shouldn't show on form confirmation only
618
+ - Fixed textarea-rich pictures had relative instead of absolute urls (thanks to David Alexander)
619
+ - Fixed dropdown-multi were not saved when form confirmation is turned on
620
+ - Fixed images shouldn't be shows if not present on the disk (form confirmation only)
621
+ - Fixed plug-in description
622
+ - Code cleanup
623
+
624
  v2.1.1 - 11/07/2011
625
  - Fixed compatibility with Theme My Login plug-in (introduced with v2.1.0) (thanks to Michele and Mark)
626
  - Fixed compatibility with WP-reCAPTCHA plug-in (thanks to des for the patch)
cimy_uef_admin.php CHANGED
@@ -711,7 +711,7 @@ function cimy_admin_define_extra_fields() {
711
  <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 />
712
 
713
  <!-- SHOW IN A&U EXTENDED -->
714
- <input type="checkbox" name="show_in_aeu[0]" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in Users Extended menu", $cimy_uef_domain); ?><br />
715
 
716
  <!-- SHOW IN THE SEARCH ENGINE -->
717
  <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 />
@@ -780,7 +780,6 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
780
 
781
  if ($wp_fields) {
782
  $field_anchor = "field_wp_";
783
- $disable_it = ' disabled="disabled"';
784
  $div_id = "wp_extrafields";
785
  $form_id = "form_wp_fields";
786
  }
@@ -788,7 +787,6 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
788
  $field_anchor = "field_";
789
  $div_id = "extrafields";
790
  $form_id = "form_extra_fields";
791
- $disable_it = '';
792
  }
793
 
794
  $add_caption = $submit_msgs['add_caption'];
@@ -851,7 +849,6 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
851
  $style = "";
852
 
853
  foreach ($allFields as $field) {
854
-
855
  $id = $field['ID'];
856
  $order = $field['F_ORDER'];
857
  $name = esc_attr($field['NAME']);
@@ -861,197 +858,33 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
861
  $type = $field['TYPE'];
862
  $rules = $field['RULES'];
863
  $fieldset = $field["FIELDSET"];
864
-
865
- $text = "";
866
- $checkbox = "";
867
- $radio = "";
868
-
869
- $dis_maxlength = "";
870
- $dis_canbeempty = "";
871
- $dis_checkemail = "";
872
- $dis_equalto = "";
873
- $dis_equalto_casesens = "";
874
- $dis_equalto_regex = "";
875
- $dis_value = "";
876
-
877
- // disable rules for certain fields
878
- if (!in_array($type, $rule_maxlen))
879
- $dis_maxlength = ' disabled="disabled"';
880
-
881
- if (!in_array($type, $rule_email))
882
- $dis_checkemail = ' disabled="disabled"';
883
-
884
- if (!in_array($type, $rule_canbeempty))
885
- $dis_canbeempty = ' disabled="disabled"';
886
-
887
- if (!in_array($type, $rule_equalto))
888
- $dis_equalto = ' disabled="disabled"';
889
-
890
- if (!in_array($type, $rule_equalto_case_sensitive))
891
- $dis_equalto_casesens = ' disabled="disabled"';
892
 
893
- if (!in_array($type, $rule_equalto_regex))
894
- $dis_equalto_regex = ' disabled="disabled"';
895
-
896
- // set selected type for every field
897
- $selected_type[$type] = ' selected="selected"';
898
-
899
  // MIN LEN
900
- if (isset($rules['min_length'])) {
901
- $minlen = ' checked="checked"';
902
  $minLength = $rules['min_length'];
903
- }
904
- else {
905
- $minlen = "";
906
  $minLength = "";
907
- }
908
-
909
  // EXACT LEN
910
- if (isset($rules['exact_length'])) {
911
- $exactlen = ' checked="checked"';
912
  $exactLength = $rules['exact_length'];
913
- }
914
- else {
915
- $exactlen = "";
916
  $exactLength = "";
917
- }
918
-
919
  // MAX LEN
920
- if (isset($rules['max_length'])) {
921
- $maxlen = ' checked="checked"';
922
  $maxLength = $rules['max_length'];
923
- }
924
- else {
925
- $maxlen = "";
926
- $maxLength = "";
927
- }
928
-
929
- if ($rules['can_be_empty'])
930
- $emp = ' checked="checked"';
931
- else
932
- $emp = "";
933
-
934
- if ($rules['email'])
935
- $email = ' checked="checked"';
936
- else
937
- $email = "";
938
-
939
- if ($rules['edit'] == 'ok_edit')
940
- $okedit = ' selected="selected"';
941
- else
942
- $okedit = "";
943
-
944
- if ($rules['edit'] == 'edit_only_if_empty')
945
- $editonlyifempty = ' selected="selected"';
946
- else
947
- $editonlyifempty = "";
948
-
949
- if ($rules['edit'] == 'edit_only_by_admin')
950
- $editonlybyadmin = ' selected="selected"';
951
- else
952
- $editonlybyadmin = "";
953
-
954
- if ($rules['edit'] == 'edit_only_by_admin_or_if_empty')
955
- $editonlybyadminorifempty = ' selected="selected"';
956
- else
957
- $editonlybyadminorifempty = "";
958
-
959
- if ($rules['edit'] == 'no_edit')
960
- $noedit = ' selected="selected"';
961
- else
962
- $noedit = "";
963
-
964
- if (isset($rules['equal_to'])) {
965
- $equal = ' checked="checked"';
966
- $equalTo = $rules['equal_to'];
967
-
968
- if ($rules['equal_to_case_sensitive'])
969
- $equalto_casesens = ' checked="checked"';
970
-
971
- if ($rules['equal_to_regex'])
972
- $equalto_regex = ' checked="checked"';
973
- }
974
- else {
975
- $equal = "";
976
- $equalTo = "";
977
- $equalto_casesens = "";
978
- $equalto_regex = "";
979
- }
980
-
981
- $equalTo = esc_attr($equalTo);
982
-
983
- if ($rules['show_in_reg'])
984
- $show_in_reg = ' checked="checked"';
985
- else
986
- $show_in_reg = "";
987
-
988
- if (is_multisite()) {
989
- // uploading files not supported with WordPress MU
990
- if (in_array($type, $cimy_uef_file_types)) {
991
- $show_in_reg = ' disabled="disabled"';
992
- }
993
- }
994
-
995
- if ($rules['show_in_profile'])
996
- $show_in_profile = ' checked="checked"';
997
  else
998
- $show_in_profile = "";
999
-
1000
- if ($rules['show_in_aeu'])
1001
- $show_in_aeu = ' checked="checked"';
1002
- else
1003
- $show_in_aeu = "";
1004
-
1005
- if ($rules['show_in_search'])
1006
- $show_in_search = ' checked="checked"';
1007
- else
1008
- $show_in_search = "";
1009
-
1010
- if ($rules['show_in_blog'])
1011
- $show_in_blog = ' checked="checked"';
1012
- else
1013
- $show_in_blog = "";
1014
 
1015
- if ($rules['email_admin'])
1016
- $email_admin = ' checked="checked"';
1017
  else
1018
- $email_admin = "";
1019
 
 
1020
  $advanced_options = $rules['advanced_options'];
1021
 
1022
- // SHOW LEVEL
1023
- $show_anonymous = '';
1024
- $show_subscriber = '';
1025
- $show_contributor = '';
1026
- $show_author = '';
1027
- $show_editor = '';
1028
- $show_admin = '';
1029
- $show_view_cimy_extra_fields = '';
1030
-
1031
- switch ($rules['show_level']) {
1032
- case '-1':
1033
- $show_anonymous = ' selected="selected"';
1034
- break;
1035
- case '0':
1036
- $show_subscriber = ' selected="selected"';
1037
- break;
1038
- case '1':
1039
- $show_contributor = ' selected="selected"';
1040
- break;
1041
- case '2':
1042
- $show_author = ' selected="selected"';
1043
- break;
1044
- case '5':
1045
- $show_editor = ' selected="selected"';
1046
- break;
1047
- case '8':
1048
- $show_admin = ' selected="selected"';
1049
- break;
1050
- case 'view_cimy_extra_fields':
1051
- $show_view_cimy_extra_fields = ' selected="selected"';
1052
- break;
1053
- }
1054
-
1055
  if (in_array($type, $cimy_uef_file_types)) {
1056
  $min_length_caption = __("Min size", $cimy_uef_domain)." (KB)";
1057
  $exact_length_caption = __("Exact size", $cimy_uef_domain)." (KB)";
@@ -1087,21 +920,16 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1087
  }
1088
  ?>
1089
  <label><strong><?php _e("Name"); ?></strong><br />
1090
- <input name="name[<?php echo $order ?>]" type="text" value="<?php echo $name ?>" maxlength="<?php echo $max_length_name ?>"<?php echo $disable_it; ?> /></label><br /><br />
1091
  <input name="oldname[<?php echo $order ?>]" type="hidden" value="<?php echo $name ?>" />
1092
  <label><strong><?php _e("Value"); ?></strong><br />
1093
  <textarea name="value[<?php echo $order ?>]" rows="2" cols="17"><?php echo $value; ?></textarea></label>
1094
  <br /><br />
1095
  <label><strong><?php _e("Type", $cimy_uef_domain); ?></strong><br />
1096
- <select name="type[<?php echo $order ?>]"<?php echo $disable_it; ?>>
1097
  <?php
1098
- foreach($available_types as $this_type) {
1099
- echo '<option value="'.$this_type.'"'.$selected_type[$this_type].'>'.$this_type.'</option>';
1100
-
1101
- if (isset($selected_type[$this_type]))
1102
- unset($selected_type[$this_type]);
1103
- echo "\n";
1104
- }
1105
  ?>
1106
  </select>
1107
  </label>
@@ -1123,39 +951,40 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1123
  </td>
1124
  <td style="vertical-align: middle;">
1125
  <!-- MIN LENGTH -->
1126
- <input type="checkbox" name="minlen[<?php echo $order ?>]" value="1"<?php echo $minlen.$dis_maxlength ?> /> <?php echo $min_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: &nbsp;&nbsp;&nbsp;<input type="text" name="minlength[<?php echo $order ?>]" value="<?php echo $minLength ?>" maxlength="5" size="5"<?php echo $dis_maxlength ?> /><br />
1127
 
1128
  <!-- EXACT LENGTH -->
1129
- <input type="checkbox" name="exactlen[<?php echo $order ?>]" value="1"<?php echo $exactlen.$dis_maxlength ?> /> <?php echo $exact_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: <input type="text" name="exactlength[<?php echo $order ?>]" value="<?php echo $exactLength ?>" maxlength="5" size="5"<?php echo $dis_maxlength ?> /><br />
1130
 
1131
  <!-- MAX LENGTH -->
1132
- <input type="checkbox" name="maxlen[<?php echo $order ?>]" value="1"<?php echo $maxlen.$dis_maxlength ?> /> <?php echo $max_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: &nbsp;&nbsp;<input type="text" name="maxlength[<?php echo $order ?>]" value="<?php echo $maxLength ?>" maxlength="5" size="5"<?php echo $dis_maxlength ?> /><br />
1133
 
1134
- <input type="checkbox" name="empty[<?php echo $order ?>]" value="1"<?php echo $emp.$dis_canbeempty ?> /> <?php _e("Can be empty", $cimy_uef_domain); ?><br />
1135
- <input type="checkbox" name="email[<?php echo $order ?>]" value="1"<?php echo $email.$dis_checkemail ?> /> <?php _e("Check for E-mail syntax", $cimy_uef_domain); ?><br />
1136
 
1137
  <select name="edit[<?php echo $order ?>]">
1138
- <option value="ok_edit"<?php echo $okedit ?>><?php _e("Can be modified", $cimy_uef_domain); ?></option>
1139
- <option value="edit_only_if_empty"<?php echo $editonlyifempty ?>><?php _e("Can be modified only if empty", $cimy_uef_domain); ?></option>
1140
- <option value="edit_only_by_admin"<?php echo $editonlybyadmin ?>><?php _e("Can be modified only by admin", $cimy_uef_domain); ?></option>
1141
- <option value="edit_only_by_admin_or_if_empty"<?php echo $editonlybyadminorifempty ?>><?php _e("Can be modified only by admin or if empty", $cimy_uef_domain); ?></option>
1142
- <option value="no_edit"<?php echo $noedit ?>><?php _e("Cannot be modified", $cimy_uef_domain); ?></option>
1143
  </select>
1144
  <br />
1145
 
1146
  <!-- EQUAL TO -->
1147
- <input type="checkbox" name="equal[<?php echo $order ?>]" value="1"<?php echo $equal.$dis_equalto ?> /> <?php _e("Should be equal TO", $cimy_uef_domain); ?>: <input type="text" name="equalto[<?php echo $order ?>]" maxlength="500" value="<?php echo $equalTo ?>"<?php echo $dis_equalto ?> /><br />
1148
  <!-- CASE SENSITIVE -->
1149
- &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="equalto_casesens[<?php echo $order ?>]" value="1"<?php echo $equalto_casesens.$dis_equalto_casesens; ?> /> <?php _e("Case sensitive", $cimy_uef_domain); ?><br />
1150
  <!-- REGEX -->
1151
- &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="equalto_regex[<?php echo $order ?>]" value="1"<?php echo $equalto_regex.$dis_equalto_regex; ?> /> <?php _e("Regular Expression", $cimy_uef_domain); ?><br />
1152
 
1153
 
1154
  <!-- SHOW IN REGISTRATION -->
1155
- <input type="checkbox" name="show_in_reg[<?php echo $order ?>]" value="1"<?php echo $show_in_reg ?> /> <?php _e("Show the field in the registration", $cimy_uef_domain); ?><br />
 
1156
 
1157
  <!-- SHOW IN PROFILE -->
1158
- <input type="checkbox" name="show_in_profile[<?php echo $order ?>]" value="1"<?php echo $show_in_profile ?><?php echo $disable_it; ?> /> <?php _e("Show the field in User's profile", $cimy_uef_domain); ?><br />
1159
  <?php
1160
  if ($wp_fields) {
1161
  ?>
@@ -1164,24 +993,24 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1164
  }
1165
  ?>
1166
  <!-- SHOW IN A&U EXTENDED -->
1167
- <input type="checkbox" name="show_in_aeu[<?php echo $order ?>]" value="1"<?php echo $show_in_aeu ?> /> <?php _e("Show the field in Users Extended menu", $cimy_uef_domain); ?><br />
1168
 
1169
  <!-- SHOW IN THE SEARCH -->
1170
- <input type="checkbox" name="show_in_search[<?php echo $order ?>]" value="1"<?php echo $show_in_search ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?><br />
1171
 
1172
  <!-- SHOW IN THE BLOG -->
1173
- <input type="checkbox" name="show_in_blog[<?php echo $order ?>]" value="1"<?php echo $show_in_blog ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?><br />
1174
 
1175
  <!-- SHOW SECURITY LEVEL -->
1176
  <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
1177
  <select name="show_level[<?php echo $order ?>]">
1178
- <option value="-1"<?php echo $show_anonymous ?>><?php _e("Anonymous"); ?></option>
1179
- <option value="0"<?php echo $show_subscriber ?>><?php echo translate_user_role("Subscriber"); ?></option>
1180
- <option value="1"<?php echo $show_contributor ?>><?php echo translate_user_role("Contributor"); ?></option>
1181
- <option value="2"<?php echo $show_author ?>><?php echo translate_user_role("Author"); ?></option>
1182
- <option value="5"<?php echo $show_editor ?>><?php echo translate_user_role("Editor"); ?></option>
1183
- <option value="8"<?php echo $show_admin ?>><?php echo translate_user_role("Administrator"); ?></option>
1184
- <option value="view_cimy_extra_fields"<?php echo $show_view_cimy_extra_fields ?>><?php _e("User has 'view_cimy_extra_fields' capability", $cimy_uef_domain); ?></option>
1185
  </select>
1186
  <br />
1187
 
@@ -1189,7 +1018,7 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
1189
  if (!$wp_fields) {
1190
  ?>
1191
  <!-- EMAIL ADMIN -->
1192
- <input type="checkbox" name="email_admin[<?php echo $order ?>]" value="1"<?php echo $email_admin ?> /> <?php _e("Send an email to the admin if the user changes its value", $cimy_uef_domain); ?><br />
1193
  <?php
1194
  }
1195
  ?>
@@ -1273,18 +1102,8 @@ function cimy_admin_users_list_page() {
1273
 
1274
  if (!cimy_check_admin('list_users'))
1275
  return;
1276
-
1277
- $options = cimy_get_options();
1278
-
1279
- if (isset($_POST["cimy_uef_users_per_page"])) {
1280
- $users_per_page = $_POST["cimy_uef_users_per_page"];
1281
- $options["users_per_page"] = $users_per_page;
1282
-
1283
- cimy_set_options($options);
1284
- }
1285
- else
1286
- $users_per_page = $options["users_per_page"];
1287
 
 
1288
  $dropdown_first_item = '--- '.__("select", $cimy_uef_domain).' ---';
1289
 
1290
  $extra_fields = get_cimyFields();
@@ -1321,61 +1140,228 @@ function cimy_admin_users_list_page() {
1321
  else
1322
  $fieldset_selection = -1;
1323
 
1324
- // yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it!
1325
- class Cimy_User_Search extends WP_User_Search {
1326
- function Cimy_User_Search ($search_term = '', $page = '', $role = '', $users_per_page = 50) {
1327
- $this->search_term = $search_term;
1328
- $this->raw_page = ( '' == $page ) ? false : (int) $page;
1329
- $this->page = (int) ( '' == $page ) ? 1 : $page;
1330
- $this->role = $role;
1331
- $this->users_per_page = intval($users_per_page);
1332
-
1333
- $this->prepare_query();
1334
- $this->query();
1335
- $this->prepare_vars_for_template_usage();
1336
-
1337
- // paging will be done after Cimy search has filtered out items
1338
- //$this->do_paging();
1339
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1340
 
1341
- function page_links() {
1342
- echo str_replace("?", "?page=au_extended&amp;", $this->paging_text);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1343
  }
1344
  }
 
 
 
 
 
 
1345
 
1346
- // Query the users
1347
- $wp_user_search = new Cimy_User_Search(empty($_POST['usersearch']) ? "" : $_POST['usersearch'], empty($_GET['userspage']) ? "" : $_GET['userspage'], empty($_GET['role']) ? "" : $_GET['role'], $users_per_page);
1348
- $search_result = $wp_user_search->get_results();
1349
 
1350
- // search into extra field engine
1351
- $i = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1352
 
1353
- foreach ($search_result as $userid) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1354
  foreach ($extra_fields as $ef) {
1355
  $ef_id = $ef["ID"];
1356
  $ef_type = $ef["TYPE"];
1357
  $ef_name = $ef["NAME"];
1358
 
1359
  $ef_search = "";
1360
-
1361
  if (isset($_POST["ef_search"][$ef_name])) {
1362
  $ef_search = $_POST["ef_search"][$ef_name];
1363
  }
1364
 
1365
- if ($ef_search != "") {
1366
  $remove = false;
1367
- $ef_value = $wpdb->get_var("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$userid." AND FIELD_ID=".$ef_id);
1368
 
1369
  if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url") || ($ef_type == "file")) {
1370
  if (stristr($ef_value, $ef_search) === FALSE) {
1371
  $remove = true;
1372
  }
1373
  } else if ($ef_type == "checkbox") {
1374
- if (($ef_search == "1") AND ($ef_value != "YES")) {
1375
  $remove = true;
1376
  }
1377
  } else if ($ef_type == "radio") {
1378
- if (($ef_search == $ef_id) AND ($ef_value != "selected")) {
1379
  $remove = true;
1380
  }
1381
  } else if ($ef_type == "dropdown") {
@@ -1396,20 +1382,14 @@ function cimy_admin_users_list_page() {
1396
  }
1397
 
1398
  if ($remove) {
1399
- unset($wp_user_search->results[$i]);
1400
- $wp_user_search->total_users_for_query--;
1401
  break;
1402
  }
1403
  }
1404
  }
1405
-
1406
- $i++;
1407
  }
1408
-
1409
- $wp_user_search->paging_text = "";
1410
- // oh yeah baby, now it's time for paging!
1411
- $wp_user_search->do_paging();
1412
-
1413
  ?>
1414
  <div class="wrap">
1415
 
@@ -1420,28 +1400,40 @@ function cimy_admin_users_list_page() {
1420
  <h2><?php
1421
  _e("Users Extended", $cimy_uef_domain);
1422
 
1423
- if ( current_user_can( 'create_users' ) ) { ?>
1424
- <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
1425
- <?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
1426
- <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
1427
  <?php }
1428
- if ( $wp_user_search->is_search() )
1429
- printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;')." (%s)</span>", esc_html($wp_user_search->search_term), $wp_user_search->total_users_for_query);
1430
  ?></h2>
1431
  <form id="posts-filter" action="" method="post"><?php
1432
  wp_nonce_field('extrafieldnewvalue', 'extrafieldnewvaluenonce', false);
1433
  $role_links = array();
1434
- $users_of_blog = count_users();
1435
- $total_users = $users_of_blog['total_users'];
1436
- $avail_roles =& $users_of_blog['avail_roles'];
1437
- unset($users_of_blog);
 
 
 
 
 
 
 
 
1438
 
1439
  $current_role = false;
1440
- $class = empty($_GET['role']) ? ' class="current"' : '';
1441
- $role_links[] = "<li><a href='users.php?page=au_extended'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
 
 
 
 
1442
 
1443
- foreach ( $wp_roles->get_names() as $this_role => $name ) {
1444
- if ( !isset($avail_roles[$this_role]) )
1445
  continue;
1446
 
1447
  $class = '';
@@ -1451,71 +1443,30 @@ function cimy_admin_users_list_page() {
1451
  $class = ' class="current"';
1452
  }
1453
 
1454
- $name = translate_user_role( $name );
1455
- $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
1456
  $tmp_link = esc_url(add_query_arg('role', $this_role));
1457
  $role_links[] = "<li><a href=\"$tmp_link\"$class>" . $name . '</a>';
1458
  }
1459
 
1460
- echo '<ul class="subsubsub">'.implode(' |</li>', $role_links) . '</li></ul>';
1461
  unset($role_links);
1462
  ?>
1463
- <p id="post-search" class="search-box">
1464
- <input type="text" class="search-input" id="post-search-input" name="usersearch" value="<?php echo esc_attr($wp_user_search->search_term); ?>" />
1465
- <input type="submit" value="<?php _e( 'Search Users' ); ?>" class="button" />
1466
- </p>
1467
-
1468
- <div class="tablenav">
1469
- <?php if ( $wp_user_search->results_are_paged() ) : ?>
1470
- <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
1471
- <?php endif; ?>
1472
-
1473
- <br class="clear" />
1474
-
1475
- <br class="clear" />
1476
- <?php if ( is_wp_error( $wp_user_search->search_errors ) ) : ?>
1477
  <div class="error">
1478
  <ul>
1479
  <?php
1480
- foreach ( $wp_user_search->search_errors->get_error_messages() as $message )
1481
- echo "<li>$message</li>";
1482
  ?>
1483
  </ul>
1484
  </div>
1485
-
1486
  <?php endif; ?>
1487
-
1488
-
1489
- <?php if ( $wp_user_search->is_search() ) : ?>
1490
- <p><a href="users.php?page=au_extended"><?php _e('&laquo; Back to All Users'); ?></a></p>
1491
- <?php endif; ?>
1492
- </div>
1493
- <?php if ( $wp_user_search->get_results() ) :
1494
- wp_print_scripts('admin-forms');
1495
- ?>
1496
- <div class="alignleft actions">
1497
- <label><?php _e("Fieldset", $cimy_uef_domain); ?>
1498
- <?php echo cimy_fieldsetOptions($fieldset_selection, 0, true); ?>
1499
- </label>
1500
-
1501
- <?php _e("Users per page", $cimy_uef_domain); ?>
1502
- <select name="cimy_uef_users_per_page">
1503
- <?php
1504
- $users_per_page_list = array(10, 50, 100, 500, 1000, 5000);
1505
-
1506
- foreach ($users_per_page_list as $item) {
1507
- echo "<option";
1508
-
1509
- if ($item == $users_per_page)
1510
- echo ' selected="selected"';
1511
-
1512
- echo ">".$item."</option>";
1513
- }
1514
- ?>
1515
- </select>
1516
- <input class="button" type="submit" name="submit" value="<?php _e("Apply"); ?>" />
1517
- </div>
1518
-
1519
  <table class="widefat" cellpadding="3" cellspacing="3" width="100%">
1520
  <?php
1521
  $thead_str = '<tr class="thead">';
@@ -1620,22 +1571,12 @@ function cimy_admin_users_list_page() {
1620
  $search_input = '<input type="text" name="ef_search['.$name_esc_attr.']" value="'.$search_value.'" size="6" />';
1621
  break;
1622
  case "checkbox":
1623
- if ($search_value != "")
1624
- $checkbox_selected = ' checked="checked"';
1625
- else
1626
- $checkbox_selected = "";
1627
-
1628
- $search_input = '<input type="checkbox" name="ef_search['.$name_esc_attr.']" value="1"'.$checkbox_selected.' />';
1629
  $write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name_esc_attr.'"><input type="checkbox" name="ef_write['.$name_esc_attr.']" value="1" />';
1630
  break;
1631
 
1632
  case "radio":
1633
- if ($search_value == $id)
1634
- $radio_selected = ' checked="checked"';
1635
- else
1636
- $radio_selected = "";
1637
-
1638
- $search_input = '<input type="radio" name="ef_search['.$name_esc_attr.']" value="'.$id.'"'.$radio_selected.' />';
1639
  $write_input[$i] = '<td>'.$label.'</td><td><input type="radio" name="ef_write['.$name_esc_attr.']" value="'.$label.'" />';
1640
  break;
1641
  }
@@ -1668,10 +1609,7 @@ function cimy_admin_users_list_page() {
1668
  </tfoot>
1669
  <?php
1670
  $style = '';
1671
-
1672
- foreach ($wp_user_search->get_results() as $userid) {
1673
- $user_object = new WP_User($userid);
1674
-
1675
  $roles = $user_object->roles;
1676
  $role = array_shift($roles);
1677
  $email = $user_object->user_email;
@@ -1688,7 +1626,7 @@ function cimy_admin_users_list_page() {
1688
  $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
1689
  $numposts = count_user_posts($user_object->ID);
1690
 
1691
- if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "'>$numposts</a>";
1692
  echo "
1693
  <tr $style>
1694
 
@@ -1698,22 +1636,24 @@ function cimy_admin_users_list_page() {
1698
  echo "</th>";
1699
 
1700
  if (!in_array("username", $options['aue_hidden_fields'])) {
1701
-
1702
  // produce username clickable
1703
- if ( current_user_can( 'edit_user', $user_object->ID ) ) {
1704
  $current_user = wp_get_current_user();
1705
 
1706
  if ($current_user->ID == $user_object->ID) {
1707
  $edit = 'profile.php';
1708
  } else {
1709
- $edit = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
1710
  }
1711
  $edit = "<a href=\"$edit\">$user_object->user_login</a>";
1712
  } else {
1713
  $edit = $user_object->user_login;
1714
  }
1715
 
1716
- $avatar = get_avatar( $user_object->user_email, 32 );
 
 
 
1717
  echo "<td class=\"username column-username\"><strong>$avatar $edit</strong></td>";
1718
  }
1719
 
@@ -1726,7 +1666,9 @@ function cimy_admin_users_list_page() {
1726
  }
1727
 
1728
  if (!in_array("role", $options['aue_hidden_fields'])) {
1729
- $role_name = translate_user_role($wp_roles->role_names[$role]);
 
 
1730
 
1731
  echo "<td class=\"role column-role\">";
1732
  echo $role_name;
@@ -1750,9 +1692,6 @@ function cimy_admin_users_list_page() {
1750
  cimy_insert_ExtraFields_if_not_exist($user_object->ID, $field_id);
1751
  }
1752
 
1753
- // retrieve extra fields data from DB
1754
- $ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$user_object->ID, ARRAY_A);
1755
-
1756
  foreach ($extra_fields as $thisField) {
1757
  $name = $thisField['NAME'];
1758
  $name_esc_attr = esc_attr($thisField['NAME']);
@@ -1769,30 +1708,24 @@ function cimy_admin_users_list_page() {
1769
 
1770
  if ($rules['show_in_aeu']) {
1771
  $field_id = $thisField['ID'];
1772
-
1773
- foreach ($ef_db as $d_field) {
1774
- if ($d_field['FIELD_ID'] == $field_id) {
1775
- $field = cimy_uef_sanitize_content($d_field['VALUE']);
1776
- //$field = esc_attr($d_field['VALUE']);
1777
- }
1778
- }
1779
 
1780
  echo "<td>";
1781
  echo "<div id=\"edit-".$user_object->ID."-".$name_esc_attr."\">";
1782
  echo "<div id=\"value-".$user_object->ID."-".$name_esc_attr."\">";
1783
 
1784
  if ($type == "picture-url") {
1785
- if ($field == "")
1786
  $field = $value;
1787
 
1788
- if ($field != "") {
1789
  if (intval($rules['equal_to'])) {
1790
- echo '<a target="_blank" href="'.$field.'">';
1791
- echo '<img src="'.$field.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
1792
  echo "</a>";
1793
  }
1794
  else {
1795
- echo '<img src="'.$field.'" alt="picture" />';
1796
  }
1797
 
1798
  echo "<br />";
@@ -1800,34 +1733,30 @@ function cimy_admin_users_list_page() {
1800
  }
1801
  }
1802
  else if ($type == "picture") {
1803
- if ($field == "")
1804
  $field = $value;
1805
 
1806
- if ($field != "") {
1807
- //$profileuser = get_user_to_edit($user_object->ID);
1808
- //$user_login = $profileuser->user_login;
1809
-
1810
  $user_login = $user_object->user_login;
1811
-
1812
  $value_thumb = cimy_get_thumb_path($field);
1813
  $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($field));
1814
  $file_on_server = $cuef_upload_path.$user_login."/".basename($field);
1815
 
1816
  echo "\n\t\t";
1817
-
1818
  if (is_file($file_thumb)) {
1819
- echo '<a target="_blank" href="'.$field.'"><img src="'.$value_thumb.'" alt="picture" /></a><br />';
1820
  echo "\n\t\t";
1821
  }
1822
  else if (is_file($file_on_server)) {
1823
- echo '<img src="'.$field.'" alt="picture" /><br />';
1824
  echo "\n\t\t";
1825
  }
1826
  }
1827
  }
1828
  else if ($type == "file") {
1829
- echo '<a target="_blank" href="'.$field.'">';
1830
- echo basename($field);
1831
  echo '</a>';
1832
  }
1833
  else if ($type == "registration-date") {
@@ -1837,10 +1766,10 @@ function cimy_admin_users_list_page() {
1837
  else
1838
  $registration_date = cimy_get_formatted_date($field);
1839
 
1840
- echo $registration_date;
1841
  }
1842
  else
1843
- echo $field;
1844
 
1845
  echo "</div>";
1846
  if ((!in_array($type, $cimy_uef_file_types)) && ($type != "radio") && ($type != "registration-date") && (current_user_can('edit_user', $user_object->ID)))
@@ -1856,16 +1785,7 @@ function cimy_admin_users_list_page() {
1856
 
1857
  ?>
1858
  </table>
1859
-
1860
- <div class="tablenav">
1861
-
1862
- <?php if ( $wp_user_search->results_are_paged() ) : ?>
1863
- <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
1864
- <?php endif; ?>
1865
-
1866
- <br class="clear" />
1867
- </div>
1868
-
1869
  <?php endif; ?>
1870
 
1871
  <?php if (!empty($write_input)) : ?>
@@ -1906,7 +1826,7 @@ function cimy_uef_admin_ajax_edit() {
1906
  /* <![CDATA[ */
1907
  var postL10n = {
1908
  ok: "<?php echo esc_js(__('OK')); ?>",
1909
- cancel: "<?php echo esc_js( __('Cancel')); ?>",
1910
  dropdown_first_item: "<?php echo esc_js($dropdown_first_item); ?>"
1911
  };
1912
  try{convertEntities(postL10n);}catch(e){};
711
  <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 />
712
 
713
  <!-- SHOW IN A&U EXTENDED -->
714
+ <input type="checkbox" name="show_in_aeu[0]" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in Users Extended section", $cimy_uef_domain); ?><br />
715
 
716
  <!-- SHOW IN THE SEARCH ENGINE -->
717
  <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 />
780
 
781
  if ($wp_fields) {
782
  $field_anchor = "field_wp_";
 
783
  $div_id = "wp_extrafields";
784
  $form_id = "form_wp_fields";
785
  }
787
  $field_anchor = "field_";
788
  $div_id = "extrafields";
789
  $form_id = "form_extra_fields";
 
790
  }
791
 
792
  $add_caption = $submit_msgs['add_caption'];
849
  $style = "";
850
 
851
  foreach ($allFields as $field) {
 
852
  $id = $field['ID'];
853
  $order = $field['F_ORDER'];
854
  $name = esc_attr($field['NAME']);
858
  $type = $field['TYPE'];
859
  $rules = $field['RULES'];
860
  $fieldset = $field["FIELDSET"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
861
 
 
 
 
 
 
 
862
  // MIN LEN
863
+ if (isset($rules['min_length']))
 
864
  $minLength = $rules['min_length'];
865
+ else
 
 
866
  $minLength = "";
867
+
 
868
  // EXACT LEN
869
+ if (isset($rules['exact_length']))
 
870
  $exactLength = $rules['exact_length'];
871
+ else
 
 
872
  $exactLength = "";
873
+
 
874
  // MAX LEN
875
+ if (isset($rules['max_length']))
 
876
  $maxLength = $rules['max_length'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
  else
878
+ $maxLength = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
879
 
880
+ if (isset($rules['equal_to']))
881
+ $equalTo = $rules['equal_to'];
882
  else
883
+ $equalTo = "";
884
 
885
+ $equalTo = esc_attr($equalTo);
886
  $advanced_options = $rules['advanced_options'];
887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  if (in_array($type, $cimy_uef_file_types)) {
889
  $min_length_caption = __("Min size", $cimy_uef_domain)." (KB)";
890
  $exact_length_caption = __("Exact size", $cimy_uef_domain)." (KB)";
920
  }
921
  ?>
922
  <label><strong><?php _e("Name"); ?></strong><br />
923
+ <input name="name[<?php echo $order ?>]" type="text" value="<?php echo $name ?>" maxlength="<?php echo $max_length_name ?>"<?php disabled(true, $wp_fields, true); ?> /></label><br /><br />
924
  <input name="oldname[<?php echo $order ?>]" type="hidden" value="<?php echo $name ?>" />
925
  <label><strong><?php _e("Value"); ?></strong><br />
926
  <textarea name="value[<?php echo $order ?>]" rows="2" cols="17"><?php echo $value; ?></textarea></label>
927
  <br /><br />
928
  <label><strong><?php _e("Type", $cimy_uef_domain); ?></strong><br />
929
+ <select name="type[<?php echo $order ?>]"<?php disabled(true, $wp_fields, true); ?>>
930
  <?php
931
+ foreach($available_types as $this_type)
932
+ echo "<option value=\"".$this_type."\"".selected($type, $this_type, false).">".$this_type."</option>\n";
 
 
 
 
 
933
  ?>
934
  </select>
935
  </label>
951
  </td>
952
  <td style="vertical-align: middle;">
953
  <!-- MIN LENGTH -->
954
+ <input type="checkbox" name="minlen[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['min_length']), true); disabled(false, in_array($type, $rule_maxlen), true); ?> /> <?php echo $min_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: &nbsp;&nbsp;&nbsp;<input type="text" name="minlength[<?php echo $order ?>]" value="<?php echo $minLength ?>" maxlength="5" size="5"<?php disabled(false, in_array($type, $rule_maxlen), true); ?> /><br />
955
 
956
  <!-- EXACT LENGTH -->
957
+ <input type="checkbox" name="exactlen[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['exact_length']), true); disabled(false, in_array($type, $rule_maxlen), true); ?> /> <?php echo $exact_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: <input type="text" name="exactlength[<?php echo $order ?>]" value="<?php echo $exactLength ?>" maxlength="5" size="5"<?php disabled(false, in_array($type, $rule_maxlen), true); ?> /><br />
958
 
959
  <!-- MAX LENGTH -->
960
+ <input type="checkbox" name="maxlen[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['max_length']), true); disabled(false, in_array($type, $rule_maxlen), true); ?> /> <?php echo $max_length_caption; ?> [1-<?php echo $max_length_value_caption; ?>]: &nbsp;&nbsp;<input type="text" name="maxlength[<?php echo $order ?>]" value="<?php echo $maxLength ?>" maxlength="5" size="5"<?php disabled(false, in_array($type, $rule_maxlen), true); ?> /><br />
961
 
962
+ <input type="checkbox" name="empty[<?php echo $order ?>]" value="1"<?php checked(true, $rules['can_be_empty'], true); disabled(false, in_array($type, $rule_canbeempty), true); ?> /> <?php _e("Can be empty", $cimy_uef_domain); ?><br />
963
+ <input type="checkbox" name="email[<?php echo $order ?>]" value="1"<?php checked(true, $rules['email'], true); disabled(false, in_array($type, $rule_email), true); ?> /> <?php _e("Check for E-mail syntax", $cimy_uef_domain); ?><br />
964
 
965
  <select name="edit[<?php echo $order ?>]">
966
+ <option value="ok_edit"<?php selected('ok_edit', $rules['edit'], true); ?>><?php _e("Can be modified", $cimy_uef_domain); ?></option>
967
+ <option value="edit_only_if_empty"<?php selected('edit_only_if_empty', $rules['edit'], true); ?>><?php _e("Can be modified only if empty", $cimy_uef_domain); ?></option>
968
+ <option value="edit_only_by_admin"<?php selected('edit_only_by_admin', $rules['edit'], true); ?>><?php _e("Can be modified only by admin", $cimy_uef_domain); ?></option>
969
+ <option value="edit_only_by_admin_or_if_empty"<?php selected('edit_only_by_admin_or_if_empty', $rules['edit'], true); ?>><?php _e("Can be modified only by admin or if empty", $cimy_uef_domain); ?></option>
970
+ <option value="no_edit"<?php selected('no_edit', $rules['edit'], true); ?>><?php _e("Cannot be modified", $cimy_uef_domain); ?></option>
971
  </select>
972
  <br />
973
 
974
  <!-- EQUAL TO -->
975
+ <input type="checkbox" name="equal[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['equal_to']), true); disabled(false, in_array($type, $rule_equalto), true); ?> /> <?php _e("Should be equal TO", $cimy_uef_domain); ?>: <input type="text" name="equalto[<?php echo $order ?>]" maxlength="500" value="<?php echo $equalTo ?>"<?php disabled(false, in_array($type, $rule_equalto), true); ?> /><br />
976
  <!-- CASE SENSITIVE -->
977
+ &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="equalto_casesens[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['equal_to']) && $rules['equal_to_case_sensitive'], true); disabled(false, in_array($type, $rule_equalto_case_sensitive), true); ?> /> <?php _e("Case sensitive", $cimy_uef_domain); ?><br />
978
  <!-- REGEX -->
979
+ &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="equalto_regex[<?php echo $order ?>]" value="1"<?php checked(true, isset($rules['equal_to']) && $rules['equal_to_regex'], true); disabled(false, in_array($type, $rule_equalto_regex), true); ?> /> <?php _e("Regular Expression", $cimy_uef_domain); ?><br />
980
 
981
 
982
  <!-- SHOW IN REGISTRATION -->
983
+ <!-- uploading files not supported with WordPress MS during registration due to email confirmation -->
984
+ <input type="checkbox" name="show_in_reg[<?php echo $order ?>]" value="1"<?php checked(true, $rules['show_in_reg'], true); disabled(true, is_multisite() && in_array($type, $cimy_uef_file_types), true); ?> /> <?php _e("Show the field in the registration", $cimy_uef_domain); ?><br />
985
 
986
  <!-- SHOW IN PROFILE -->
987
+ <input type="checkbox" name="show_in_profile[<?php echo $order ?>]" value="1"<?php checked(true, $rules['show_in_profile'], true); disabled(true, $wp_fields, true); ?> /> <?php _e("Show the field in User's profile", $cimy_uef_domain); ?><br />
988
  <?php
989
  if ($wp_fields) {
990
  ?>
993
  }
994
  ?>
995
  <!-- SHOW IN A&U EXTENDED -->
996
+ <input type="checkbox" name="show_in_aeu[<?php echo $order ?>]" value="1"<?php checked(true, $rules['show_in_aeu'], true); ?> /> <?php _e("Show the field in Users Extended section", $cimy_uef_domain); ?><br />
997
 
998
  <!-- SHOW IN THE SEARCH -->
999
+ <input type="checkbox" name="show_in_search[<?php echo $order ?>]" value="1"<?php checked(true, $rules['show_in_search'], true); ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?><br />
1000
 
1001
  <!-- SHOW IN THE BLOG -->
1002
+ <input type="checkbox" name="show_in_blog[<?php echo $order ?>]" value="1"<?php checked(true, $rules['show_in_blog'], true); ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?><br />
1003
 
1004
  <!-- SHOW SECURITY LEVEL -->
1005
  <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
1006
  <select name="show_level[<?php echo $order ?>]">
1007
+ <option value="-1"<?php selected("-1", $rules['show_level'], true); ?>><?php _e("Anonymous"); ?></option>
1008
+ <option value="0"<?php selected("0", $rules['show_level'], true); ?>><?php echo translate_user_role("Subscriber"); ?></option>
1009
+ <option value="1"<?php selected("1", $rules['show_level'], true); ?>><?php echo translate_user_role("Contributor"); ?></option>
1010
+ <option value="2"<?php selected("2", $rules['show_level'], true); ?>><?php echo translate_user_role("Author"); ?></option>
1011
+ <option value="5"<?php selected("5", $rules['show_level'], true); ?>><?php echo translate_user_role("Editor"); ?></option>
1012
+ <option value="8"<?php selected("8", $rules['show_level'], true); ?>><?php echo translate_user_role("Administrator"); ?></option>
1013
+ <option value="view_cimy_extra_fields"<?php selected("view_cimy_extra_fields", $rules['show_level'], true); ?>><?php _e("User has 'view_cimy_extra_fields' capability", $cimy_uef_domain); ?></option>
1014
  </select>
1015
  <br />
1016
 
1018
  if (!$wp_fields) {
1019
  ?>
1020
  <!-- EMAIL ADMIN -->
1021
+ <input type="checkbox" name="email_admin[<?php echo $order ?>]" value="1"<?php checked(true, $rules['email_admin'], true); ?> /> <?php _e("Send an email to the admin if the user changes its value", $cimy_uef_domain); ?><br />
1022
  <?php
1023
  }
1024
  ?>
1102
 
1103
  if (!cimy_check_admin('list_users'))
1104
  return;
 
 
 
 
 
 
 
 
 
 
 
1105
 
1106
+ $options = cimy_get_options();
1107
  $dropdown_first_item = '--- '.__("select", $cimy_uef_domain).' ---';
1108
 
1109
  $extra_fields = get_cimyFields();
1140
  else
1141
  $fieldset_selection = -1;
1142
 
1143
+ $usersearch = empty($_REQUEST['s']) ? "" : $_REQUEST['s'];
1144
+ $role = empty($_REQUEST['role']) ? "" : $_REQUEST['role'];
1145
+ $paged = intval(empty($_GET['userspage']) ? "1" : $_GET['userspage']);
1146
+
1147
+ if (is_network_admin()) {
1148
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-ms-users-list-table.php');
1149
+ class WP_Cimy_Users_List_Table extends WP_MS_Users_List_Table {
1150
+ var $old_args = array();
1151
+ function prepare_items() {
1152
+ global $role, $usersearch, $wpdb;
1153
+
1154
+ $usersearch = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
1155
+ $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
1156
+
1157
+ $args = array(
1158
+ 'role' => $role,
1159
+ 'search' => $usersearch,
1160
+ 'fields' => 'all_with_meta',
1161
+ 'blog_id' => 0,
1162
+ );
1163
+
1164
+ if ($role == 'super') {
1165
+ $logins = implode("', '", get_super_admins());
1166
+ $args['include'] = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')");
1167
+ }
1168
+
1169
+ // If the network is large and a search is not being performed, show only the latest users with no paging in order
1170
+ // to avoid expensive count queries.
1171
+ if (!$usersearch && (get_blog_count() >= 10000)) {
1172
+ if (!isset($_REQUEST['orderby']))
1173
+ $_GET['orderby'] = $_REQUEST['orderby'] = 'id';
1174
+ if (!isset($_REQUEST['order']))
1175
+ $_GET['order'] = $_REQUEST['order'] = 'DESC';
1176
+ $args['count_total'] = false;
1177
+ }
1178
 
1179
+ $args['search'] = ltrim($args['search'], '*');
1180
+
1181
+ if (isset($_REQUEST['orderby']))
1182
+ $args['orderby'] = $_REQUEST['orderby'];
1183
+
1184
+ if (isset($_REQUEST['order']))
1185
+ $args['order'] = $_REQUEST['order'];
1186
+
1187
+ // Query the user IDs for this page
1188
+ $wp_user_search = new WP_User_Query($args);
1189
+
1190
+ $this->items = $wp_user_search->get_results();
1191
+ $this->old_args = $args;
1192
+ }
1193
+
1194
+ function prepare_items2($include, $exclude) {
1195
+ global $wpdb;
1196
+ if (isset($_POST["cimy_uef_users_per_page"])) {
1197
+ $users_per_page = intval($_POST["cimy_uef_users_per_page"]);
1198
+ if ($user = wp_get_current_user())
1199
+ update_user_meta($user->ID, 'users_network_per_page', $users_per_page);
1200
+ }
1201
+ $users_per_page = $this->get_items_per_page('users_network_per_page');
1202
+ $paged = $this->get_pagenum();
1203
+ $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
1204
+
1205
+ if ($role == 'super') {
1206
+ $logins = implode("', '", get_super_admins());
1207
+ $include = array_diff($wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')"), $exclude);
1208
+ }
1209
+
1210
+ $args = array_merge($this->old_args, array(
1211
+ 'number' => $users_per_page,
1212
+ 'offset' => ($paged-1) * $users_per_page,
1213
+ 'include' => $include,
1214
+ 'exclude' => $exclude,
1215
+ ));
1216
+ // Query the user IDs for this page
1217
+ $wp_user_search = new WP_User_Query($args);
1218
+
1219
+ $this->items = $wp_user_search->get_results();
1220
+
1221
+ $this->set_pagination_args(array(
1222
+ 'total_items' => $wp_user_search->get_total(),
1223
+ 'per_page' => $users_per_page,
1224
+ ));
1225
+ }
1226
+ function bulk_actions($which) {}
1227
+ function extra_tablenav($which) {
1228
+ if ('top' != $which)
1229
+ return;
1230
+
1231
+ global $cimy_uef_domain;
1232
+ if (isset($_POST["fieldset"][0]))
1233
+ $fieldset_selection = $_POST["fieldset"][0];
1234
+ else
1235
+ $fieldset_selection = -1;
1236
+ ?>
1237
+ <label><?php _e("Fieldset", $cimy_uef_domain); ?>
1238
+ <?php echo cimy_fieldsetOptions($fieldset_selection, 0, true); ?>
1239
+ </label>
1240
+
1241
+ <?php _e("Users per page", $cimy_uef_domain); ?>
1242
+ <input type="text" name="cimy_uef_users_per_page" value="<?php echo $this->get_users_per_page(); ?>" size="4" />
1243
+ <input class="button" type="submit" name="submit" value="<?php _e("Apply"); ?>" />
1244
+ <?php
1245
+ }
1246
+ function get_total() { return $this->_pagination_args['total_items']; }
1247
+ function get_users_per_page() { return $this->_pagination_args['per_page']; }
1248
  }
1249
  }
1250
+ else {
1251
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-users-list-table.php');
1252
+ class WP_Cimy_Users_List_Table extends WP_Users_List_Table {
1253
+ var $old_args = array();
1254
+ function prepare_items() {
1255
+ global $role, $usersearch;
1256
 
1257
+ $usersearch = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
1258
+ $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
 
1259
 
1260
+ $args = array(
1261
+ 'role' => $role,
1262
+ 'search' => $usersearch,
1263
+ 'fields' => 'all_with_meta'
1264
+ );
1265
+
1266
+ if ('' !== $args['search'])
1267
+ $args['search'] = '*' . $args['search'] . '*';
1268
+
1269
+ if ($this->is_site_users)
1270
+ $args['blog_id'] = $this->site_id;
1271
+
1272
+ if (isset($_REQUEST['orderby']))
1273
+ $args['orderby'] = $_REQUEST['orderby'];
1274
+
1275
+ if (isset($_REQUEST['order']))
1276
+ $args['order'] = $_REQUEST['order'];
1277
 
1278
+ // Query the user IDs for this page
1279
+ $wp_user_search = new WP_User_Query($args);
1280
+
1281
+ $this->items = $wp_user_search->get_results();
1282
+ $this->old_args = $args;
1283
+ }
1284
+
1285
+ function prepare_items2($include, $exclude) {
1286
+ $per_page = ($this->is_site_users) ? 'site_users_network_per_page' : 'users_per_page';
1287
+ if (isset($_POST["cimy_uef_users_per_page"])) {
1288
+ $users_per_page = intval($_POST["cimy_uef_users_per_page"]);
1289
+ if ($user = wp_get_current_user())
1290
+ update_user_meta($user->ID, $per_page, $users_per_page);
1291
+ }
1292
+ $users_per_page = $this->get_items_per_page($per_page);
1293
+ $paged = $this->get_pagenum();
1294
+ $args = array_merge($this->old_args, array(
1295
+ 'number' => $users_per_page,
1296
+ 'offset' => ($paged-1) * $users_per_page,
1297
+ 'include' => $include,
1298
+ 'exclude' => $exclude,
1299
+ ));
1300
+ // Query the user IDs for this page
1301
+ $wp_user_search = new WP_User_Query($args);
1302
+
1303
+ $this->items = $wp_user_search->get_results();
1304
+
1305
+ $this->set_pagination_args(array(
1306
+ 'total_items' => $wp_user_search->get_total(),
1307
+ 'per_page' => $users_per_page,
1308
+ ));
1309
+ }
1310
+ function bulk_actions($which) {}
1311
+ function extra_tablenav($which) {
1312
+ if ('top' != $which)
1313
+ return;
1314
+
1315
+ global $cimy_uef_domain;
1316
+ if (isset($_POST["fieldset"][0]))
1317
+ $fieldset_selection = $_POST["fieldset"][0];
1318
+ else
1319
+ $fieldset_selection = -1;
1320
+ ?>
1321
+ <label><?php _e("Fieldset", $cimy_uef_domain); ?>
1322
+ <?php echo cimy_fieldsetOptions($fieldset_selection, 0, true); ?>
1323
+ </label>
1324
+
1325
+ <?php _e("Users per page", $cimy_uef_domain); ?>
1326
+ <input type="text" name="cimy_uef_users_per_page" value="<?php echo $this->get_users_per_page(); ?>" size="4" />
1327
+ <input class="button" type="submit" name="submit" value="<?php _e("Apply"); ?>" />
1328
+ <?php
1329
+ }
1330
+ function get_total() { return $this->_pagination_args['total_items']; }
1331
+ function get_users_per_page() { return $this->_pagination_args['per_page']; }
1332
+ }
1333
+ }
1334
+ $cimy_users_table = new WP_Cimy_Users_List_Table();
1335
+ $cimy_users_table->prepare_items();
1336
+ $search_result = $cimy_users_table->items;
1337
+
1338
+ $excluded_users = array();
1339
+ // search into extra field engine
1340
+ foreach ($search_result as $key=>$user_object) {
1341
  foreach ($extra_fields as $ef) {
1342
  $ef_id = $ef["ID"];
1343
  $ef_type = $ef["TYPE"];
1344
  $ef_name = $ef["NAME"];
1345
 
1346
  $ef_search = "";
 
1347
  if (isset($_POST["ef_search"][$ef_name])) {
1348
  $ef_search = $_POST["ef_search"][$ef_name];
1349
  }
1350
 
1351
+ if (!empty($ef_search)) {
1352
  $remove = false;
1353
+ $ef_value = get_cimyFieldValue($user_object->ID, $ef_name);
1354
 
1355
  if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url") || ($ef_type == "file")) {
1356
  if (stristr($ef_value, $ef_search) === FALSE) {
1357
  $remove = true;
1358
  }
1359
  } else if ($ef_type == "checkbox") {
1360
+ if (($ef_search == "1") && ($ef_value != "YES")) {
1361
  $remove = true;
1362
  }
1363
  } else if ($ef_type == "radio") {
1364
+ if (($ef_search == $ef_id) && ($ef_value != "selected")) {
1365
  $remove = true;
1366
  }
1367
  } else if ($ef_type == "dropdown") {
1382
  }
1383
 
1384
  if ($remove) {
1385
+ $excluded_users[] = $user_object->ID;
 
1386
  break;
1387
  }
1388
  }
1389
  }
 
 
1390
  }
1391
+ $cimy_users_table->prepare_items2(array(), $excluded_users);
1392
+ $users_found = $cimy_users_table->get_total();
 
 
 
1393
  ?>
1394
  <div class="wrap">
1395
 
1400
  <h2><?php
1401
  _e("Users Extended", $cimy_uef_domain);
1402
 
1403
+ if (current_user_can('create_users')) { ?>
1404
+ <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a>
1405
+ <?php } elseif (is_multisite() && current_user_can('promote_users')) { ?>
1406
+ <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add Existing', 'user'); ?></a>
1407
  <?php }
1408
+ if (!empty($usersearch))
1409
+ printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;')." (%s)</span>", esc_html($usersearch), $users_found);
1410
  ?></h2>
1411
  <form id="posts-filter" action="" method="post"><?php
1412
  wp_nonce_field('extrafieldnewvalue', 'extrafieldnewvaluenonce', false);
1413
  $role_links = array();
1414
+ if (is_network_admin()) {
1415
+ $super_admins = get_super_admins();
1416
+ $total_admins = count($super_admins);
1417
+ $total_users = get_user_count();
1418
+ }
1419
+ else {
1420
+ $super_admins = array();
1421
+ $users_of_blog = count_users();
1422
+ $total_users = $users_of_blog['total_users'];
1423
+ $avail_roles =& $users_of_blog['avail_roles'];
1424
+ unset($users_of_blog);
1425
+ }
1426
 
1427
  $current_role = false;
1428
+ $class = empty($role) ? ' class="current"' : '';
1429
+ $role_links['all'] = "<li><a href='users.php?page=users_extended'$class>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)) . '</a>';
1430
+ if (is_network_admin()) {
1431
+ $class = $role == 'super' ? ' class="current"' : '';
1432
+ $role_links['super'] = "<li><a href='" . network_admin_url('users.php?page=users_extended&role=super') . "'$class>" . sprintf(_n('Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins), number_format_i18n($total_admins)) . '</a>';
1433
+ }
1434
 
1435
+ foreach ($wp_roles->get_names() as $this_role => $name) {
1436
+ if (!isset($avail_roles[$this_role]))
1437
  continue;
1438
 
1439
  $class = '';
1443
  $class = ' class="current"';
1444
  }
1445
 
1446
+ $name = translate_user_role($name);
1447
+ $name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role]);
1448
  $tmp_link = esc_url(add_query_arg('role', $this_role));
1449
  $role_links[] = "<li><a href=\"$tmp_link\"$class>" . $name . '</a>';
1450
  }
1451
 
1452
+ echo '<ul class="subsubsub">'.implode(' | </li>', $role_links) . '</li></ul>';
1453
  unset($role_links);
1454
  ?>
1455
+ <?php
1456
+ $cimy_users_table->search_box(__('Search Users'), 'user');
1457
+ $cimy_users_table->display_tablenav("top");
1458
+ ?>
1459
+ <?php if (isset($errors) && is_wp_error($errors)) : ?>
 
 
 
 
 
 
 
 
 
1460
  <div class="error">
1461
  <ul>
1462
  <?php
1463
+ foreach ($errors->get_error_messages() as $err)
1464
+ echo "<li>$err</li>\n";
1465
  ?>
1466
  </ul>
1467
  </div>
 
1468
  <?php endif; ?>
1469
+ <?php if ($cimy_users_table->items) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1470
  <table class="widefat" cellpadding="3" cellspacing="3" width="100%">
1471
  <?php
1472
  $thead_str = '<tr class="thead">';
1571
  $search_input = '<input type="text" name="ef_search['.$name_esc_attr.']" value="'.$search_value.'" size="6" />';
1572
  break;
1573
  case "checkbox":
1574
+ $search_input = '<input type="checkbox" name="ef_search['.$name_esc_attr.']" value="1"'.checked(false, empty($search_value), false).' />';
 
 
 
 
 
1575
  $write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name_esc_attr.'"><input type="checkbox" name="ef_write['.$name_esc_attr.']" value="1" />';
1576
  break;
1577
 
1578
  case "radio":
1579
+ $search_input = '<input type="radio" name="ef_search['.$name_esc_attr.']" value="'.$id.'"'.checked($search_value, $id, false).' />';
 
 
 
 
 
1580
  $write_input[$i] = '<td>'.$label.'</td><td><input type="radio" name="ef_write['.$name_esc_attr.']" value="'.$label.'" />';
1581
  break;
1582
  }
1609
  </tfoot>
1610
  <?php
1611
  $style = '';
1612
+ foreach ($cimy_users_table->items as $user_object) {
 
 
 
1613
  $roles = $user_object->roles;
1614
  $role = array_shift($roles);
1615
  $email = $user_object->user_email;
1626
  $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
1627
  $numposts = count_user_posts($user_object->ID);
1628
 
1629
+ if (0 < $numposts) $numposts = "<a href='edit.php?author=".$user_object->ID."' title='" . __('View posts by this author') . "'>$numposts</a>";
1630
  echo "
1631
  <tr $style>
1632
 
1636
  echo "</th>";
1637
 
1638
  if (!in_array("username", $options['aue_hidden_fields'])) {
 
1639
  // produce username clickable
1640
+ if (current_user_can('edit_user', $user_object->ID)) {
1641
  $current_user = wp_get_current_user();
1642
 
1643
  if ($current_user->ID == $user_object->ID) {
1644
  $edit = 'profile.php';
1645
  } else {
1646
+ $edit = esc_url(add_query_arg('wp_http_referer', urlencode(esc_url(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id=$user_object->ID"));
1647
  }
1648
  $edit = "<a href=\"$edit\">$user_object->user_login</a>";
1649
  } else {
1650
  $edit = $user_object->user_login;
1651
  }
1652
 
1653
+ if (in_array($user_object->user_login, $super_admins))
1654
+ $edit.= ' - ' . __('Super Admin');
1655
+
1656
+ $avatar = get_avatar($user_object->user_email, 32);
1657
  echo "<td class=\"username column-username\"><strong>$avatar $edit</strong></td>";
1658
  }
1659
 
1666
  }
1667
 
1668
  if (!in_array("role", $options['aue_hidden_fields'])) {
1669
+ $role_name = "";
1670
+ if (!empty($wp_roles->role_names[$role]))
1671
+ $role_name = translate_user_role($wp_roles->role_names[$role]);
1672
 
1673
  echo "<td class=\"role column-role\">";
1674
  echo $role_name;
1692
  cimy_insert_ExtraFields_if_not_exist($user_object->ID, $field_id);
1693
  }
1694
 
 
 
 
1695
  foreach ($extra_fields as $thisField) {
1696
  $name = $thisField['NAME'];
1697
  $name_esc_attr = esc_attr($thisField['NAME']);
1708
 
1709
  if ($rules['show_in_aeu']) {
1710
  $field_id = $thisField['ID'];
1711
+ $field = get_cimyFieldValue($user_object->ID, $name);
 
 
 
 
 
 
1712
 
1713
  echo "<td>";
1714
  echo "<div id=\"edit-".$user_object->ID."-".$name_esc_attr."\">";
1715
  echo "<div id=\"value-".$user_object->ID."-".$name_esc_attr."\">";
1716
 
1717
  if ($type == "picture-url") {
1718
+ if (empty($field))
1719
  $field = $value;
1720
 
1721
+ if (!empty($field)) {
1722
  if (intval($rules['equal_to'])) {
1723
+ echo '<a target="_blank" href="'.esc_attr($field).'">';
1724
+ echo '<img src="'.esc_attr($field).'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
1725
  echo "</a>";
1726
  }
1727
  else {
1728
+ echo '<img src="'.esc_attr($field).'" alt="picture" />';
1729
  }
1730
 
1731
  echo "<br />";
1733
  }
1734
  }
1735
  else if ($type == "picture") {
1736
+ if (empty($field))
1737
  $field = $value;
1738
 
1739
+ if (!empty($field)) {
 
 
 
1740
  $user_login = $user_object->user_login;
1741
+
1742
  $value_thumb = cimy_get_thumb_path($field);
1743
  $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($field));
1744
  $file_on_server = $cuef_upload_path.$user_login."/".basename($field);
1745
 
1746
  echo "\n\t\t";
 
1747
  if (is_file($file_thumb)) {
1748
+ echo '<a target="_blank" href="'.esc_attr($field).'"><img src="'.esc_attr($value_thumb).'" alt="picture" /></a><br />';
1749
  echo "\n\t\t";
1750
  }
1751
  else if (is_file($file_on_server)) {
1752
+ echo '<img src="'.esc_attr($field).'" alt="picture" /><br />';
1753
  echo "\n\t\t";
1754
  }
1755
  }
1756
  }
1757
  else if ($type == "file") {
1758
+ echo '<a target="_blank" href="'.esc_attr($field).'">';
1759
+ echo esc_html(basename($field));
1760
  echo '</a>';
1761
  }
1762
  else if ($type == "registration-date") {
1766
  else
1767
  $registration_date = cimy_get_formatted_date($field);
1768
 
1769
+ echo esc_html($registration_date);
1770
  }
1771
  else
1772
+ echo cimy_uef_sanitize_content($field);
1773
 
1774
  echo "</div>";
1775
  if ((!in_array($type, $cimy_uef_file_types)) && ($type != "radio") && ($type != "registration-date") && (current_user_can('edit_user', $user_object->ID)))
1785
 
1786
  ?>
1787
  </table>
1788
+ <?php $cimy_users_table->display_tablenav("bottom"); ?>
 
 
 
 
 
 
 
 
 
1789
  <?php endif; ?>
1790
 
1791
  <?php if (!empty($write_input)) : ?>
1826
  /* <![CDATA[ */
1827
  var postL10n = {
1828
  ok: "<?php echo esc_js(__('OK')); ?>",
1829
+ cancel: "<?php echo esc_js(__('Cancel')); ?>",
1830
  dropdown_first_item: "<?php echo esc_js($dropdown_first_item); ?>"
1831
  };
1832
  try{convertEntities(postL10n);}catch(e){};
cimy_uef_email_handler.php CHANGED
@@ -229,7 +229,8 @@ function cimy_uef_activate($message) {
229
  function cimy_uef_activate_signup($key) {
230
  global $wpdb, $current_site, $cimy_uef_domain;
231
 
232
- require_once( ABSPATH . WPINC . '/registration.php');
 
233
  $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."signups WHERE activation_key = %s", $key) );
234
 
235
  if ( empty($signup) )
229
  function cimy_uef_activate_signup($key) {
230
  global $wpdb, $current_site, $cimy_uef_domain;
231
 
232
+ // seems no more required since WP 3.1
233
+ // require_once( ABSPATH . WPINC . '/registration.php');
234
  $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."signups WHERE activation_key = %s", $key) );
235
 
236
  if ( empty($signup) )
cimy_uef_functions.php CHANGED
@@ -284,8 +284,12 @@ function get_cimyFieldValue($user_id, $field_name, $field_value=false) {
284
 
285
  $field_data = cimy_change_radio_labels($field_data, $user_id);
286
 
287
- if (($field_name) && ($user_id))
288
- $field_data = $field_data[0]['VALUE'];
 
 
 
 
289
 
290
  return $field_data;
291
  }
@@ -348,26 +352,27 @@ function cimy_dropDownOptions($values, $selected) {
348
  $sel_items = explode(",", $selected);
349
  $html_options = "";
350
  $sel_i = 0;
351
-
352
  foreach ($items as $item) {
353
  $item_clean = trim($item, "\t\n\r");
354
 
355
  $html_options.= "\n\t\t\t";
356
- $html_options.= '<option value="'.$item_clean.'"';
357
-
358
- if (isset($sel_items[$sel_i])) {
359
- if ($sel_items[$sel_i] == $item_clean) {
 
360
  $sel_i++;
361
- $html_options.= ' selected="selected"';
362
  }
363
  }
364
 
365
- $html_options.= ">".$item_clean."</option>";
366
  }
367
-
368
  $ret = array();
369
  $ret['html'] = $html_options;
370
- $ret['label'] = $label;
371
 
372
  return $ret;
373
  }
@@ -424,24 +429,14 @@ function cimy_fieldsetOptions($selected=0, $order="", $select_all=false) {
424
  $html.= "\t<option value=\"$i\" selected=\"selected\">".__("no fieldset", $cimy_uef_domain)."</option>\n";
425
  }
426
  else {
427
- if ($select_all) {
428
- if (-1 == $selected)
429
- $selected_txt = " selected=\"selected\"";
430
- else
431
- $selected_txt = "";
432
- $html.= "\t<option value=\"-1\"".$selected_txt.">".__("All")."</option>\n";
433
- }
434
 
435
  if (!empty($options['fieldset_title'])) {
436
  $fieldset_titles = explode(',', $options['fieldset_title']);
437
 
438
  foreach ($fieldset_titles as $fieldset) {
439
- if ($i == $selected)
440
- $selected_txt = " selected=\"selected\"";
441
- else
442
- $selected_txt = "";
443
-
444
- $html.= "\t<option value=\"$i\"".$selected_txt.">".$fieldset."</option>\n";
445
  $i++;
446
  }
447
  }
284
 
285
  $field_data = cimy_change_radio_labels($field_data, $user_id);
286
 
287
+ if (($field_name) && ($user_id)) {
288
+ if (isset($field_data[0]['VALUE']))
289
+ $field_data = $field_data[0]['VALUE'];
290
+ else
291
+ $field_data = "";
292
+ }
293
 
294
  return $field_data;
295
  }
352
  $sel_items = explode(",", $selected);
353
  $html_options = "";
354
  $sel_i = 0;
355
+
356
  foreach ($items as $item) {
357
  $item_clean = trim($item, "\t\n\r");
358
 
359
  $html_options.= "\n\t\t\t";
360
+ $html_options.= '<option value="'.esc_attr($item_clean).'"';
361
+
362
+ if (isset($sel_items[$sel_i])) {
363
+ $is_selected = selected($item_clean, $sel_items[$sel_i], false);
364
+ if (!empty($is_selected)) {
365
  $sel_i++;
366
+ $html_options.= $is_selected;
367
  }
368
  }
369
 
370
+ $html_options.= ">".esc_html($item_clean)."</option>";
371
  }
372
+
373
  $ret = array();
374
  $ret['html'] = $html_options;
375
+ $ret['label'] = cimy_uef_sanitize_content($label);
376
 
377
  return $ret;
378
  }
429
  $html.= "\t<option value=\"$i\" selected=\"selected\">".__("no fieldset", $cimy_uef_domain)."</option>\n";
430
  }
431
  else {
432
+ if ($select_all)
433
+ $html.= "\t<option value=\"-1\"".selected(-1, $selected, false).">".__("All")."</option>\n";
 
 
 
 
 
434
 
435
  if (!empty($options['fieldset_title'])) {
436
  $fieldset_titles = explode(',', $options['fieldset_title']);
437
 
438
  foreach ($fieldset_titles as $fieldset) {
439
+ $html.= "\t<option value=\"$i\"".selected($i, $selected, false).">".esc_html($fieldset)."</option>\n";
 
 
 
 
 
440
  $i++;
441
  }
442
  }
cimy_uef_init_mce.php CHANGED
@@ -78,9 +78,12 @@ if (!empty($cimy_uef_register_page)) {
78
  'content_css' => $mce_css,
79
  'language' => $mce_locale,
80
  'spellchecker_languages' => $mce_spellchecker_languages,
81
- 'theme_advanced_resizin' => "true",
82
- 'theme_advanced_resize_horizontal' => "false",
83
  'dialog_type' => "modal",
 
 
 
84
  'plugins' => implode( ',', $plugins ),
85
  );
86
 
78
  'content_css' => $mce_css,
79
  'language' => $mce_locale,
80
  'spellchecker_languages' => $mce_spellchecker_languages,
81
+ 'theme_advanced_resizin' => true,
82
+ 'theme_advanced_resize_horizontal' => false,
83
  'dialog_type' => "modal",
84
+ 'relative_urls' => false,
85
+ 'convert_urls' => false,
86
+ 'remove_script_host' => false,
87
  'plugins' => implode( ',', $plugins ),
88
  );
89
 
cimy_uef_options.php CHANGED
@@ -169,120 +169,19 @@ function cimy_save_options() {
169
  else
170
  $options['password_meter'] = false;
171
 
172
- if (isset($_POST['show_wp_firstname'])) {
173
- array_push($options['wp_hidden_fields'], 'firstname');
174
-
175
- if (!in_array("firstname", $old_wp_hidden_fields)) {
176
- $data = $wp_hidden_fields['firstname'];
177
-
178
- $data['num_fields'] = $tot_wp_hidden_fields;
179
- $tot_wp_hidden_fields++;
180
-
181
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
182
- }
183
- }
184
-
185
- if (isset($_POST['show_wp_lastname'])) {
186
- array_push($options['wp_hidden_fields'], 'lastname');
187
-
188
- if (!in_array("lastname", $old_wp_hidden_fields)) {
189
- $data = $wp_hidden_fields['lastname'];
190
 
191
- $data['num_fields'] = $tot_wp_hidden_fields;
192
- $tot_wp_hidden_fields++;
193
-
194
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
195
- }
196
- }
197
-
198
- if (isset($_POST['show_wp_nickname'])) {
199
- array_push($options['wp_hidden_fields'], 'nickname');
200
-
201
- if (!in_array("nickname", $old_wp_hidden_fields)) {
202
- $data = $wp_hidden_fields['nickname'];
203
-
204
- $data['num_fields'] = $tot_wp_hidden_fields;
205
- $tot_wp_hidden_fields++;
206
-
207
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
208
- }
209
- }
210
-
211
- if (isset($_POST['show_wp_email'])) {
212
- array_push($options['wp_hidden_fields'], 'email');
213
-
214
- if (!in_array("email", $old_wp_hidden_fields)) {
215
- $data = $wp_hidden_fields['email'];
216
-
217
- $data['num_fields'] = $tot_wp_hidden_fields;
218
- $tot_wp_hidden_fields++;
219
-
220
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
221
- }
222
- }
223
-
224
- if (isset($_POST['show_wp_website'])) {
225
- array_push($options['wp_hidden_fields'], 'website');
226
-
227
- if (!in_array("website", $old_wp_hidden_fields)) {
228
- $data = $wp_hidden_fields['website'];
229
-
230
- $data['num_fields'] = $tot_wp_hidden_fields;
231
- $tot_wp_hidden_fields++;
232
-
233
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
234
- }
235
- }
236
-
237
- if (isset($_POST['show_wp_aim'])) {
238
- array_push($options['wp_hidden_fields'], 'aim');
239
-
240
- if (!in_array("aim", $old_wp_hidden_fields)) {
241
- $data = $wp_hidden_fields['aim'];
242
-
243
- $data['num_fields'] = $tot_wp_hidden_fields;
244
- $tot_wp_hidden_fields++;
245
-
246
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
247
- }
248
- }
249
-
250
- if (isset($_POST['show_wp_yahoo'])) {
251
- array_push($options['wp_hidden_fields'], 'yahoo');
252
-
253
- if (!in_array("yahoo", $old_wp_hidden_fields)) {
254
- $data = $wp_hidden_fields['yahoo'];
255
-
256
- $data['num_fields'] = $tot_wp_hidden_fields;
257
- $tot_wp_hidden_fields++;
258
-
259
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
260
- }
261
- }
262
-
263
- if (isset($_POST['show_wp_jgt'])) {
264
- array_push($options['wp_hidden_fields'], 'jgt');
265
-
266
- if (!in_array("jgt", $old_wp_hidden_fields)) {
267
- $data = $wp_hidden_fields['jgt'];
268
-
269
- $data['num_fields'] = $tot_wp_hidden_fields;
270
- $tot_wp_hidden_fields++;
271
-
272
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
273
- }
274
- }
275
-
276
- if (isset($_POST['show_wp_bio-info'])) {
277
- array_push($options['wp_hidden_fields'], 'bio-info');
278
-
279
- if (!in_array("bio-info", $old_wp_hidden_fields)) {
280
- $data = $wp_hidden_fields['bio-info'];
281
-
282
- $data['num_fields'] = $tot_wp_hidden_fields;
283
- $tot_wp_hidden_fields++;
284
-
285
- cimy_save_field($action, $wpdb_wp_fields_table, $data);
286
  }
287
  }
288
  }
@@ -381,71 +280,18 @@ function cimy_show_options($results, $embedded) {
381
  }
382
 
383
  $options['fieldset_title'] = esc_attr($options['fieldset_title']);
384
- $options['mail_include_fields'] ? $mail_include_fields = ' checked="checked"' : $mail_include_fields = '';
385
- $options['confirm_email'] ? $confirm_email = ' checked="checked"' : $confirm_email = '';
386
- $options['confirm_form'] ? $confirm_form = ' checked="checked"' : $confirm_form = '';
387
  $welcome_email = $options['welcome_email'];
388
- $options['redirect_to'] == "source" ? $redirect_to_source = ' checked="checked"' : $redirect_to_source = '';
389
- ($options['captcha'] == "recaptcha") ? $recaptcha = ' checked="checked"' : $recaptcha = '';
390
- ($options['captcha'] == "securimage") ? $securimage = ' checked="checked"' : $securimage = '';
391
- ($options['captcha'] == "none") ? $no_captcha = ' checked="checked"' : $no_captcha = '';
392
  isset($options['recaptcha_public_key']) ? $recaptcha_public_key = $options['recaptcha_public_key'] : $recaptcha_public_key = '';
393
  isset($options['recaptcha_private_key']) ? $recaptcha_private_key = $options['recaptcha_private_key'] : $recaptcha_private_key = '';
394
 
395
- in_array('username', $options['aue_hidden_fields']) ? $aue_hide_username = ' checked="checked"' : $aue_hide_username = '';
396
- in_array('name', $options['aue_hidden_fields']) ? $aue_hide_name = ' checked="checked"' : $aue_hide_name = '';
397
- in_array('email', $options['aue_hidden_fields']) ? $aue_hide_email = ' checked="checked"' : $aue_hide_email = '';
398
- in_array('website', $options['aue_hidden_fields']) ? $aue_hide_website = ' checked="checked"' : $aue_hide_website = '';
399
- in_array('posts', $options['aue_hidden_fields']) ? $aue_hide_posts = ' checked="checked"' : $aue_hide_posts = '';
400
- in_array('role', $options['aue_hidden_fields']) ? $aue_hide_role = ' checked="checked"' : $aue_hide_role = '';
401
-
402
- in_array('password', $options['wp_hidden_fields']) ? $show_wp_password = ' checked="checked"' : $show_wp_password = '';
403
- in_array('password2', $options['wp_hidden_fields']) ? $show_wp_password2 = ' checked="checked"' : $show_wp_password2 = '';
404
- $options['password_meter'] ? $show_wp_password_meter = ' checked="checked"' : $show_wp_password_meter = '';
405
-
406
- in_array('firstname', $options['wp_hidden_fields']) ? $show_wp_firstname = ' checked="checked"' : $show_wp_firstname = '';
407
- in_array('lastname', $options['wp_hidden_fields']) ? $show_wp_lastname = ' checked="checked"' : $show_wp_lastname = '';
408
- in_array('nickname', $options['wp_hidden_fields']) ? $show_wp_nickname = ' checked="checked"' : $show_wp_nickname = '';
409
- in_array('website', $options['wp_hidden_fields']) ? $show_wp_website = ' checked="checked"' : $show_wp_website = '';
410
- in_array('aim', $options['wp_hidden_fields']) ? $show_wp_aim = ' checked="checked"' : $show_wp_aim = '';
411
- in_array('yahoo', $options['wp_hidden_fields']) ? $show_wp_yahoo = ' checked="checked"' : $show_wp_yahoo = '';
412
- in_array('jgt', $options['wp_hidden_fields']) ? $show_wp_jgt = ' checked="checked"' : $show_wp_jgt = '';
413
- in_array('bio-info', $options['wp_hidden_fields']) ? $show_wp_bio_info = ' checked="checked"' : $show_wp_bio_info = '';
414
-
415
  $db_options = true;
416
  }
417
  else {
418
  $db_options = false;
419
  $options['fieldset_title'] = "";
420
- $mail_include_fields= '';
421
  $welcome_email = '';
422
- $confirm_email = '';
423
- $confirm_form = '';
424
- $redirect_to_source = '';
425
- $recaptcha = '';
426
  $recaptcha_public_key = '';
427
  $recaptcha_private_key = '';
428
- $securimage = '';
429
- $no_captcha = ' checked="checked"';
430
-
431
- $aue_hide_username = '';
432
- $aue_hide_name = '';
433
- $aue_hide_email = '';
434
- $aue_hide_website = '';
435
- $aue_hide_posts = '';
436
- $aue_hide_role = '';
437
-
438
- $show_wp_password = '';
439
- $show_wp_password2 = '';
440
- $show_wp_password_meter = '';
441
- $show_wp_firstname = '';
442
- $show_wp_secondname = '';
443
- $show_wp_nickname = '';
444
- $show_wp_website = '';
445
- $show_wp_aim = '';
446
- $show_wp_yahoo = '';
447
- $show_wp_jgt = '';
448
- $show_wp_bio_info = '';
449
  }
450
 
451
  if ($wpdb->get_var("SHOW TABLES LIKE '$wpdb_wp_fields_table'") == $wpdb_wp_fields_table) {
@@ -566,7 +412,7 @@ function cimy_show_options($results, $embedded) {
566
  </tr>
567
  <tr>
568
  <th scope="row">
569
- <input type="checkbox" name="mail_include_fields" value="1"<?php echo $mail_include_fields; ?> />
570
  <?php _e("Show all fields in the welcome email", $cimy_uef_domain); ?>
571
  </th>
572
  <td>
@@ -578,7 +424,7 @@ function cimy_show_options($results, $embedded) {
578
  <?php if (!is_multisite()) { ?>
579
  <tr>
580
  <th scope="row">
581
- <input type="checkbox" name="confirm_email" value="1"<?php echo $confirm_email; ?> />
582
  <?php _e("Enable email confirmation", $cimy_uef_domain); ?>
583
  </th>
584
  <td>
@@ -591,7 +437,7 @@ function cimy_show_options($results, $embedded) {
591
  </tr>
592
  <tr>
593
  <th scope="row">
594
- <input type="checkbox" name="confirm_form" value="1"<?php echo $confirm_form; ?> />
595
  <?php _e("Enable form confirmation", $cimy_uef_domain); ?>
596
  </th>
597
  <td>
@@ -611,7 +457,7 @@ function cimy_show_options($results, $embedded) {
611
  </tr>
612
  <tr>
613
  <th scope="row">
614
- <input type="checkbox" name="redirect_to" value="source"<?php echo $redirect_to_source; ?> />
615
  <?php _e("Redirect to the source", $cimy_uef_domain); ?>
616
  </th>
617
  <td>
@@ -623,7 +469,7 @@ function cimy_show_options($results, $embedded) {
623
  <?php } ?>
624
  <tr>
625
  <th scope="row">
626
- <input type="radio" name="captcha" value="none"<?php echo $no_captcha; ?> />
627
  <?php _e('No captcha', $cimy_uef_domain); ?></a>
628
  </th>
629
  <td>
@@ -631,7 +477,7 @@ function cimy_show_options($results, $embedded) {
631
  </tr>
632
  <tr>
633
  <th scope="row">
634
- <input type="radio" name="captcha" value="recaptcha"<?php echo $recaptcha; ?> />
635
  <?php _e('Enable <a href="http://www.google.com/recaptcha" target="_blank">reCAPTCHA</a>', $cimy_uef_domain); ?></a>
636
  </th>
637
  <td>
@@ -647,7 +493,7 @@ function cimy_show_options($results, $embedded) {
647
  </tr>
648
  <tr>
649
  <th scope="row">
650
- <input type="radio" name="captcha" value="securimage"<?php echo $securimage; ?> />
651
  <?php _e('Enable <a href="http://www.phpcaptcha.org/" target="_blank">Securimage Captcha</a>', $cimy_uef_domain); ?></a>
652
  </th>
653
  <td>
@@ -700,7 +546,6 @@ function cimy_show_options($results, $embedded) {
700
  <td>
701
  <?php
702
  if ($db_wp_fields >= 0) {
703
- $dis_wp_fields = "";
704
  ?>
705
  <select name="db_wp_fields">
706
  <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option>
@@ -708,10 +553,8 @@ function cimy_show_options($results, $embedded) {
708
  <option value="delete"><?php _e("Delete"); ?></option>
709
  </select><?php
710
  }
711
- else {
712
- $dis_wp_fields = ' disabled="disabled"';
713
  echo "<strong>".__("NOT PRESENT", $cimy_uef_domain)."</strong>";
714
- }
715
  ?>
716
  </td>
717
  </tr>
@@ -777,30 +620,30 @@ function cimy_show_options($results, $embedded) {
777
  <table class="form-table">
778
  <tr>
779
  <th scope="row" width="40%">
780
- <input type="checkbox" name="hide_username" value="1"<?php echo $aue_hide_username; ?> /> <?php _e("Hide username field", $cimy_uef_domain); ?>
781
  </th>
782
  <td width="60%"></td>
783
  </tr>
784
  <tr>
785
  <th>
786
- <input type="checkbox" name="hide_name" value="1"<?php echo $aue_hide_name; ?> /> <?php _e("Hide name field", $cimy_uef_domain); ?>
787
  </th>
788
  <td></td>
789
  </tr>
790
  <tr>
791
- <th scope="row"><input type="checkbox" name="hide_email" value="1"<?php echo $aue_hide_email; ?> /> <?php _e("Hide email field", $cimy_uef_domain); ?></th>
792
  <td></td>
793
  </tr>
794
  <tr>
795
- <th scope="row"><input type="checkbox" name="hide_role" value="1"<?php echo $aue_hide_role; ?> /> <?php _e("Hide role field", $cimy_uef_domain); ?></th>
796
  <td></td>
797
  </tr>
798
  <tr>
799
- <th scope="row"><input type="checkbox" name="hide_website" value="1"<?php echo $aue_hide_website; ?> /> <?php _e("Hide website field", $cimy_uef_domain); ?></th>
800
  <td></td>
801
  </tr>
802
  <tr>
803
- <th><input type="checkbox" name="hide_posts" value="1"<?php echo $aue_hide_posts; ?> /> <?php _e("Hide n. posts field", $cimy_uef_domain); ?></th>
804
  <td></td>
805
  </tr>
806
  </table>
@@ -808,47 +651,47 @@ function cimy_show_options($results, $embedded) {
808
  <h3><?php _e("WordPress hidden fields", $cimy_uef_domain); ?></h3>
809
  <table class="form-table">
810
  <tr>
811
- <th scope="row" width="40%"><input type="checkbox" name="show_wp_password" value="1"<?php echo $show_wp_password.$dis_wp_fields; ?> /> <?php _e("Show password", $cimy_uef_domain); ?></th>
812
  <td width="60%"></td>
813
  </tr>
814
  <tr>
815
- <th>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="show_wp_password2" value="1"<?php echo $show_wp_password2.$dis_wp_fields; ?> /> <?php _e("Show confirmation password", $cimy_uef_domain); ?></th>
816
  <td></td>
817
  </tr>
818
  <tr>
819
- <th>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="show_wp_password_meter" value="1"<?php echo $show_wp_password_meter.$dis_wp_fields; ?> /> <?php _e("Show password strength meter", $cimy_uef_domain); ?></th>
820
  <td></td>
821
  </tr>
822
  <tr>
823
- <th><input type="checkbox" name="show_wp_firstname" value="1"<?php echo $show_wp_firstname.$dis_wp_fields; ?> /> <?php _e("Show first name", $cimy_uef_domain); ?></th>
824
  <td></td>
825
  </tr>
826
  <tr>
827
- <th><input type="checkbox" name="show_wp_lastname" value="1"<?php echo $show_wp_lastname.$dis_wp_fields; ?> /> <?php _e("Show last name", $cimy_uef_domain); ?></th>
828
  <td></td>
829
  </tr>
830
  <tr>
831
- <th><input type="checkbox" name="show_wp_nickname" value="1"<?php echo $show_wp_nickname.$dis_wp_fields; ?> /> <?php _e("Show nickname", $cimy_uef_domain); ?></th>
832
  <td></td>
833
  </tr>
834
  <tr>
835
- <th scope="row"><input type="checkbox" name="show_wp_website" value="1"<?php echo $show_wp_website.$dis_wp_fields; ?> /> <?php _e("Show website", $cimy_uef_domain); ?></th>
836
  <td></td>
837
  </tr>
838
  <tr>
839
- <th scope="row"><input type="checkbox" name="show_wp_aim" value="1"<?php echo $show_wp_aim.$dis_wp_fields; ?> /> <?php _e("Show AIM", $cimy_uef_domain); ?></th>
840
  <td></td>
841
  </tr>
842
  <tr>
843
- <th scope="row"><input type="checkbox" name="show_wp_yahoo" value="1"<?php echo $show_wp_yahoo.$dis_wp_fields; ?> /> <?php _e("Show Yahoo IM", $cimy_uef_domain); ?></th>
844
  <td></td>
845
  </tr>
846
  <tr>
847
- <th scope="row"><input type="checkbox" name="show_wp_jgt" value="1"<?php echo $show_wp_jgt.$dis_wp_fields; ?> /> <?php _e("Show Jabber / Google Talk", $cimy_uef_domain); ?></th>
848
  <td></td>
849
  </tr>
850
  <tr>
851
- <th scope="row"><input type="checkbox" name="show_wp_bio-info" value="1"<?php echo $show_wp_bio_info.$dis_wp_fields; ?> /> <?php _e("Show Biographical Info", $cimy_uef_domain); ?></th>
852
  <td></td>
853
  </tr>
854
  </table>
169
  else
170
  $options['password_meter'] = false;
171
 
172
+ $db_wp_fields_independent = array("firstname", "lastname", "nickname", "website", "aim", "yahoo", "jgt", "bio-info");
173
+ foreach ($db_wp_fields_independent as $wp_field_independent) {
174
+ if (isset($_POST['show_wp_'.$wp_field_independent])) {
175
+ array_push($options['wp_hidden_fields'], $wp_field_independent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
+ if (!in_array($wp_field_independent, $old_wp_hidden_fields)) {
178
+ $data = $wp_hidden_fields[$wp_field_independent];
179
+
180
+ $data['num_fields'] = $tot_wp_hidden_fields;
181
+ $tot_wp_hidden_fields++;
182
+
183
+ cimy_save_field($action, $wpdb_wp_fields_table, $data);
184
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
  }
187
  }
280
  }
281
 
282
  $options['fieldset_title'] = esc_attr($options['fieldset_title']);
 
 
 
283
  $welcome_email = $options['welcome_email'];
 
 
 
 
284
  isset($options['recaptcha_public_key']) ? $recaptcha_public_key = $options['recaptcha_public_key'] : $recaptcha_public_key = '';
285
  isset($options['recaptcha_private_key']) ? $recaptcha_private_key = $options['recaptcha_private_key'] : $recaptcha_private_key = '';
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  $db_options = true;
288
  }
289
  else {
290
  $db_options = false;
291
  $options['fieldset_title'] = "";
 
292
  $welcome_email = '';
 
 
 
 
293
  $recaptcha_public_key = '';
294
  $recaptcha_private_key = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
 
297
  if ($wpdb->get_var("SHOW TABLES LIKE '$wpdb_wp_fields_table'") == $wpdb_wp_fields_table) {
412
  </tr>
413
  <tr>
414
  <th scope="row">
415
+ <input type="checkbox" name="mail_include_fields" value="1"<?php checked(true, $options['mail_include_fields'], true); ?> />
416
  <?php _e("Show all fields in the welcome email", $cimy_uef_domain); ?>
417
  </th>
418
  <td>
424
  <?php if (!is_multisite()) { ?>
425
  <tr>
426
  <th scope="row">
427
+ <input type="checkbox" name="confirm_email" value="1"<?php checked(true, $options['confirm_email'], true); ?> />
428
  <?php _e("Enable email confirmation", $cimy_uef_domain); ?>
429
  </th>
430
  <td>
437
  </tr>
438
  <tr>
439
  <th scope="row">
440
+ <input type="checkbox" name="confirm_form" value="1"<?php checked(true, $options['confirm_form'], true); ?> />
441
  <?php _e("Enable form confirmation", $cimy_uef_domain); ?>
442
  </th>
443
  <td>
457
  </tr>
458
  <tr>
459
  <th scope="row">
460
+ <input type="checkbox" name="redirect_to" value="source"<?php checked("source", $options['redirect_to'], true); ?> />
461
  <?php _e("Redirect to the source", $cimy_uef_domain); ?>
462
  </th>
463
  <td>
469
  <?php } ?>
470
  <tr>
471
  <th scope="row">
472
+ <input type="radio" name="captcha" value="none"<?php checked("none", $options['captcha'], true); ?> />
473
  <?php _e('No captcha', $cimy_uef_domain); ?></a>
474
  </th>
475
  <td>
477
  </tr>
478
  <tr>
479
  <th scope="row">
480
+ <input type="radio" name="captcha" value="recaptcha"<?php checked("recaptcha", $options['captcha'], true); ?> />
481
  <?php _e('Enable <a href="http://www.google.com/recaptcha" target="_blank">reCAPTCHA</a>', $cimy_uef_domain); ?></a>
482
  </th>
483
  <td>
493
  </tr>
494
  <tr>
495
  <th scope="row">
496
+ <input type="radio" name="captcha" value="securimage"<?php checked("securimage", $options['captcha'], true); ?> />
497
  <?php _e('Enable <a href="http://www.phpcaptcha.org/" target="_blank">Securimage Captcha</a>', $cimy_uef_domain); ?></a>
498
  </th>
499
  <td>
546
  <td>
547
  <?php
548
  if ($db_wp_fields >= 0) {
 
549
  ?>
550
  <select name="db_wp_fields">
551
  <option value="none">- <?php _e("select action", $cimy_uef_domain); ?> -</option>
553
  <option value="delete"><?php _e("Delete"); ?></option>
554
  </select><?php
555
  }
556
+ else
 
557
  echo "<strong>".__("NOT PRESENT", $cimy_uef_domain)."</strong>";
 
558
  ?>
559
  </td>
560
  </tr>
620
  <table class="form-table">
621
  <tr>
622
  <th scope="row" width="40%">
623
+ <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); ?>
624
  </th>
625
  <td width="60%"></td>
626
  </tr>
627
  <tr>
628
  <th>
629
+ <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); ?>
630
  </th>
631
  <td></td>
632
  </tr>
633
  <tr>
634
+ <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>
635
  <td></td>
636
  </tr>
637
  <tr>
638
+ <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>
639
  <td></td>
640
  </tr>
641
  <tr>
642
+ <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>
643
  <td></td>
644
  </tr>
645
  <tr>
646
+ <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>
647
  <td></td>
648
  </tr>
649
  </table>
651
  <h3><?php _e("WordPress hidden fields", $cimy_uef_domain); ?></h3>
652
  <table class="form-table">
653
  <tr>
654
+ <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>
655
  <td width="60%"></td>
656
  </tr>
657
  <tr>
658
+ <th>&nbsp;&nbsp;&nbsp;<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>
659
  <td></td>
660
  </tr>
661
  <tr>
662
+ <th>&nbsp;&nbsp;&nbsp;<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>
663
  <td></td>
664
  </tr>
665
  <tr>
666
+ <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>
667
  <td></td>
668
  </tr>
669
  <tr>
670
+ <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>
671
  <td></td>
672
  </tr>
673
  <tr>
674
+ <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>
675
  <td></td>
676
  </tr>
677
  <tr>
678
+ <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>
679
  <td></td>
680
  </tr>
681
  <tr>
682
+ <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>
683
  <td></td>
684
  </tr>
685
  <tr>
686
+ <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>
687
  <td></td>
688
  </tr>
689
  <tr>
690
+ <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>
691
  <td></td>
692
  </tr>
693
  <tr>
694
+ <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>
695
  <td></td>
696
  </tr>
697
  </table>
cimy_uef_profile.php CHANGED
<
@@ -71,7 +71,7 @@ function cimy_extract_ExtraFields() {
71
  $name = $thisField['NAME'];
72
  $rules = $thisField['RULES'];
73
  $type = $thisField['TYPE'];
74
- $label = cimy_uef_sanitize_content($thisField['LABEL']);
75
  $description = cimy_uef_sanitize_content($thisField['DESCRIPTION']);
76
  $fieldset = $thisField['FIELDSET'];
77
  $input_name = $fields_name_prefix.esc_attr($name);
@@ -130,7 +130,9 @@ function cimy_extract_ExtraFields() {
130
  echo "\t";
131
  echo "<tr>";
132
  echo "\n\t";
133
-
 
 
134
  $value = esc_attr($value);
135
  $old_value = esc_attr($old_value);