Cimy User Extra Fields - Version 1.5.0

Version Description

Download this release

Release Info

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

Code changes from version 1.4.0 to 1.5.0

README_OFFICIAL.txt CHANGED
@@ -7,39 +7,68 @@ We have developed a WordPress plug-in to do this.
7
 
8
  There are some plug-ins that do something similar, but this one wants to focus on giving the administrator the possibility to add all fields needed, on the rules that can be defined for each field, and in giving the possibility to both administration and the user to change the data inserted.
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  The plug-in adds two new menu voices in the admin for the administrator and two for users.
11
 
12
  Two new menus are:
13
 
14
- WordPress:
15
  1. "Users -> A&U Extended" - lets you show users lists with the new fields that are created
16
  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.
17
 
18
- Wordpress MU:
19
  1. "Site Admin -> Users Extended" - lets you show users lists with the new fields that are created
20
  2. "Site 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.
21
 
22
  Rules are:
23
 
24
  * min/exact/max length admitted
25
- [only for text, textarea, textarea-rich, password, picture, picture-url, avatar]
26
 
27
  * field can be empty
28
- [only for text, textarea, textarea-rich, password, picture, picture-url, dropdown, avatar]
29
 
30
  * check for e-mail address syntax
31
  [only for text, textarea, textarea-rich, password]
32
 
33
  * field can be modified after the registration
34
- [only for text, textarea, textarea-rich, password, picture, picture-url, checkbox, radio, dropdown, avatar]
35
  [for radio and checkbox 'edit_only_if_empty' has no effects and 'edit_only_by_admin_or_if_empty' has the same effect as edit_only_by_admin]
36
 
37
  * field equal to some value (for example accept terms and conditions)
38
  [all except avatar by default set to 512]
39
 
40
  * equal to can be or not case sensitive
41
- [only for text, textarea, textarea-rich, password, dropdown]
42
 
 
43
  * field can be hidden during registration
44
  [all]
45
 
@@ -49,33 +78,17 @@ Rules are:
49
  * field can be hidden in A&U Extended page
50
  [all]
51
 
52
- New fields will be visible in the profile and in the registration.
 
53
 
54
- As for now the plug-in supports:
55
- * text
56
- * textarea
57
- * textarea-rich
58
- * password
59
- * checkbox
60
- * radio
61
- * drop-down
62
- * picture
63
- * picture-url
64
- * registration-date
65
- * avatar
66
 
67
- future versions can have more.
 
 
 
68
 
69
- Following WordPress hidden fields can be enabled during registration:
70
- * password
71
- * first name
72
- * last name
73
- * nickname
74
- * website
75
- * Aim
76
- * Yahoo IM
77
- * Jabber/Google Talk
78
- * biographical info
79
 
80
  Bugs or suggestions can be mailed at: cimmino.marco@gmail.com
81
 
@@ -87,12 +100,37 @@ MYSQL >= 4.0
87
 
88
  INSTALLATION:
89
  - WordPress: just copy whole cimy-user-extra-fields subdir into your plug-in directory and activate it
90
- - WordPress MU: unpack the package under 'mu-plugins' directory, be sure that cimy_user_extra_fields.php is outside Cimy folder (move it if necessary), then go to "Site Admin -> Cimy User Extra Fields", press "Fix the problem" button and confirm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  UPDATE FROM A PREVIOUS VERSION:
93
  - go to Cimy User Extra Fields admin options, press "Fix the problem" button and confirm
94
 
95
 
 
 
 
 
 
 
 
 
 
 
96
  FUNCTIONS USEFUL FOR YOUR THEMES OR TEMPLATES:
97
 
98
  [Function get_cimyFieldValue]
@@ -375,7 +413,8 @@ Create the same directory needed for PICTURE support, avatars will be stored in
375
 
376
  KNOWN ISSUES:
377
  - if you add too many fields in the "A&U Extended" menu they will go out of frame
378
- - some rules are applied only during registration (apart editable and visibility rules and max length for text and password fields only)
 
379
  - registration date cannot be modified
380
  - using WordPress password to let user customize its password works, but has one issue:
381
  - on WordPress email received will contain wrong password (generated by WordPress), this due to WordPress limitation
@@ -383,7 +422,6 @@ KNOWN ISSUES:
383
  - picture and avatar upload is disabled during registration under WordPress MU, will be possible once user is activated
384
  - if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again
385
  - dropdown issues:
386
- - multiple choices dropdown are not supported
387
  - custom value is not supported
388
  - comma is not allowed as it is the delimiter
389
 
@@ -415,14 +453,20 @@ Q: Your plug-in is great, but when you will add support to add more than one cho
415
  A: This feature is here since ages, for radio field just use the same name, for dropdown field read instructions in the add field area (in the plug-in).
416
 
417
 
418
- Q: Indeed, but for multiple choices dropdown?
419
 
420
- A: This feature is not supported at the moment.
421
 
422
 
423
- Q: Uploaded images are not resized, why?
 
 
424
 
425
- A: You should add php-gd module (under Ubuntu install php5-gd package).
 
 
 
 
426
 
427
 
428
  Q: When feature XYZ will be added?
@@ -458,6 +502,47 @@ A lot of times I cannot reproduce the problem and I need more details, so if you
458
 
459
 
460
  CHANGELOG:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  v1.4.0 - 18/03/2009
462
  - Added user_id in the array returned by get_cimyFieldValue function
463
  - Added regular expression to equalTo rule for text, textarea, textarea-rich, password, dropdown (thanks to Shane Hartman for the patch)
7
 
8
  There are some plug-ins that do something similar, but this one wants to focus on giving the administrator the possibility to add all fields needed, on the rules that can be defined for each field, and in giving the possibility to both administration and the user to change the data inserted.
9
 
10
+ As for now the plug-in supports:
11
+ * text
12
+ * textarea
13
+ * textarea-rich
14
+ * password
15
+ * checkbox
16
+ * radio
17
+ * dropdown
18
+ * dropdown-multi
19
+ * picture
20
+ * picture-url
21
+ * registration-date
22
+ * avatar
23
+ * file
24
+
25
+ future versions can have more.
26
+
27
+ Following WordPress hidden fields can be enabled during registration:
28
+ * password
29
+ * first name
30
+ * last name
31
+ * nickname
32
+ * website
33
+ * Aim
34
+ * Yahoo IM
35
+ * Jabber/Google Talk
36
+ * biographical info
37
+
38
  The plug-in adds two new menu voices in the admin for the administrator and two for users.
39
 
40
  Two new menus are:
41
 
42
+ WordPress and WordPress MU per-blog registration:
43
  1. "Users -> A&U Extended" - lets you show users lists with the new fields that are created
44
  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.
45
 
46
+ Wordpress MU unique registration:
47
  1. "Site Admin -> Users Extended" - lets you show users lists with the new fields that are created
48
  2. "Site 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.
49
 
50
  Rules are:
51
 
52
  * min/exact/max length admitted
53
+ [only for text, textarea, textarea-rich, password, picture, picture-url, avatar, file]
54
 
55
  * field can be empty
56
+ [only for text, textarea, textarea-rich, password, picture, picture-url, dropdown, dropdown-multi, avatar, file]
57
 
58
  * check for e-mail address syntax
59
  [only for text, textarea, textarea-rich, password]
60
 
61
  * field can be modified after the registration
62
+ [only for text, textarea, textarea-rich, password, picture, picture-url, checkbox, radio, dropdown, dropdown-multi, avatar, file]
63
  [for radio and checkbox 'edit_only_if_empty' has no effects and 'edit_only_by_admin_or_if_empty' has the same effect as edit_only_by_admin]
64
 
65
  * field equal to some value (for example accept terms and conditions)
66
  [all except avatar by default set to 512]
67
 
68
  * equal to can be or not case sensitive
69
+ [only for text, textarea, textarea-rich, password, dropdown, dropdown-multi]
70
 
71
+ Visualization rules
72
  * field can be hidden during registration
73
  [all]
74
 
78
  * field can be hidden in A&U Extended page
79
  [all]
80
 
81
+ * field can be hidden in Search Engine (only if you installed the template)
82
+ [all]
83
 
84
+ * field can be hidden in Blog's public page (only if you installed the template)
85
+ [all]
 
 
 
 
 
 
 
 
 
 
86
 
87
+ * all visualization rules can be overridden if an user has certain rights (default=no override)
88
+ [all]
89
+
90
+ New fields will be visible everywhere by default, a part some WordPress fields.
91
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  Bugs or suggestions can be mailed at: cimmino.marco@gmail.com
94
 
100
 
101
  INSTALLATION:
102
  - WordPress: just copy whole cimy-user-extra-fields subdir into your plug-in directory and activate it
103
+
104
+ - WordPress MU:
105
+ There are two supported ways of using this plug-in under WordPress MU:
106
+
107
+ 1) Unique registration
108
+ If you want that ALL Blogs on your MU installation follow the same registration with the same fields this is the case for you.
109
+ Every blog will have shared registration page and only the site administrators (of the whole MU installation) can change it.
110
+ - unpack the package under 'mu-plugins' directory, be sure that cimy_user_extra_fields.php is outside Cimy folder (move it if necessary), then go to "Site Admin -> Cimy User Extra Fields", press "Fix the problem" button and confirm
111
+
112
+ 2) Per-Blog registration
113
+ If you want that every single Blog can define its own Extra Fields then you should choose this installation.
114
+ Every registration will have Extra Fields defined by single blogs, every user will have anyway WordPress fields shared with ALL Blogs, this how it works
115
+ WordPress MU.
116
+ - unpack the package under 'plugins' directory; BE sure that cimy_uef_mu_activation.php is installed under 'mu-plugins' directory
117
+ - then every single blog will have it under "Plugins" section
118
+
119
 
120
  UPDATE FROM A PREVIOUS VERSION:
121
  - go to Cimy User Extra Fields admin options, press "Fix the problem" button and confirm
122
 
123
 
124
+ HOW TO ASSIGN A DEFAULT VALUE TO THE EXTRA FIELDS:
125
+ 1. You can assign a default value using the VALUE textarea in the admin panel.
126
+ 2. You can use URL (only for registration page), example:
127
+ http://www.exampleofmywebsite.it/wordpress29/wp-login.php?action=register&FIELD_01=test1&FIELD_02=test2
128
+
129
+ FIELD_01 and FIELD_02 are two existing fields that will get default assignment with string "test1" and "test2".
130
+ Note 1: Field name should be upper case otherwise won't be recognized.
131
+ Note 2: These two methods can be used together, but remember that URL has higher priority.
132
+
133
+
134
  FUNCTIONS USEFUL FOR YOUR THEMES OR TEMPLATES:
135
 
136
  [Function get_cimyFieldValue]
413
 
414
  KNOWN ISSUES:
415
  - if you add too many fields in the "A&U Extended" menu they will go out of frame
416
+ - some rules are applied only during registration (apart editable and visibility rules and max length for text and password fields only) - this has been fixed using Wordpress >= 2.8.x
417
+ - some rules are never applied if you are using PHP 4.x please update to PHP 5.x as stated in the REQUIREMENTS
418
  - registration date cannot be modified
419
  - using WordPress password to let user customize its password works, but has one issue:
420
  - on WordPress email received will contain wrong password (generated by WordPress), this due to WordPress limitation
422
  - picture and avatar upload is disabled during registration under WordPress MU, will be possible once user is activated
423
  - if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again
424
  - dropdown issues:
 
425
  - custom value is not supported
426
  - comma is not allowed as it is the delimiter
427
 
453
  A: This feature is here since ages, for radio field just use the same name, for dropdown field read instructions in the add field area (in the plug-in).
454
 
455
 
456
+ Q: Uploaded images are not resized, why?
457
 
458
+ A: You should add php-gd module (under Ubuntu install php5-gd package).
459
 
460
 
461
+ Q: Why big files are not being uploaded?
462
+
463
+ A: Please check this website, tells you how to change your PHP configurations to fix this issue: http://www.radinks.com/upload/config.php
464
 
465
+
466
+ Q: Why admin user cannot see all fields even if I set to do it?
467
+
468
+ A: Probably you installed the first time WordPress on PHP4 and you experienced this bug: http://core.trac.wordpress.org/ticket/8317
469
+ To fix the problem you need to create another administrator user and change admin user to another role and then back to administrator.
470
 
471
 
472
  Q: When feature XYZ will be added?
502
 
503
 
504
  CHANGELOG:
505
+ v1.5.0 - 30/01/2010
506
+ - Added registration fields pre-filed within URL support (thanks to Charlie Markwick for sponsoring)
507
+ - Fixed WordPress MU unique registration mode was completely broken (introduced with v1.5.0 beta2) (thanks to Nicolene Heunis)
508
+ - Fixed WordPress MU per-blog registration was not working if main site had the plug-in disabled
509
+ - Fixed WordPress MU per-blog A&U Extended was not working
510
+ - Readme file updated
511
+
512
+ v1.5.0 beta2 - 22/11/2009
513
+ - Added roles support to Extra Fields (thanx to Jakob Wallsten for sponsoring)
514
+ - Added public search support (thanx to Jakob Wallsten and Nacho Arribas for sponsoring)
515
+ - Added public profile support (thanx to Jakob Wallsten and Nacho Arribas for sponsoring)
516
+ - Added WordPress MU per-blog support (thanx to Uwe Moosheimer for sponsoring)
517
+ - Fixed picture fields visualization in profile (introduced with v1.5.0 beta1)
518
+ - Fixed text fields visualization in profile
519
+ - Fixed admin page was completely screwed for some translations like Swedish (thanks to Erik Billerby for pointing it)
520
+ - Fixed some fields were ignored when adding new user from user-new.php in some circumstances (thanks to Erik Billerby for pointing it)
521
+ - Fixed rules were applied anyway when adding new user from user-new.php (introduced with v1.5.0 beta1)
522
+ - Fixed WordPress fields' rules were applied anyway when updating profile (introduced with v1.5.0 beta1)
523
+ - Fixed rules were applied in some circumstances when updating profile even if the field was hidden (introduced with v1.5.0 beta1)
524
+ - Fixed get_cimyFieldValue function was too slow when retrieving data using user_id and field_id (thanks to Erik Billerby for pointing it)
525
+ - Fixed A&U Extended search was not properly working when dropdown or dropdown-multi fields were present
526
+ - Fixed get_cimyFieldValue was returning an uncleaned label for dropdown-multi fields
527
+ - Fixed Biographical Info sometimes were disappearing for no apparent reason (thanks to Edward)
528
+ - Updated Swedish translation (Erik)
529
+ - Updated Italian translation
530
+
531
+ v1.5.0 beta1 - 16/08/2009
532
+ - Added WordPress 2.8.x support
533
+ - Added dropdown-multi support (thanks to Natural Building Network)
534
+ - Added file upload support (thanks to Karl Sandoval)
535
+ - Added rules check also during profile update (WP >= 2.8.x only)
536
+ - Added possibility to see up to 5000 users per page on A&U Extended page
537
+ - Added Spanish translation (David Gil)
538
+ - Changed max length for: label, description and value up to 50000 chars
539
+ - Fixed avatar and picture upload were not working for some languages like French (thanks to Miss K)
540
+ - Fixed Extra Fields were displayed after other plugins in the registration page (thanks to Nicolene Heunis)
541
+ - Fixed to not display 'picture' if the file does not exists in A&U Extended page
542
+ - Fixed an untranslatable word in A&U Extended page
543
+ - Readme file updated
544
+ - Updated Italian translation
545
+
546
  v1.4.0 - 18/03/2009
547
  - Added user_id in the array returned by get_cimyFieldValue function
548
  - Added regular expression to equalTo rule for text, textarea, textarea-rich, password, dropdown (thanks to Shane Hartman for the patch)
cimy_uef_admin.php CHANGED
@@ -29,8 +29,8 @@ function cimy_admin_define_extra_fields() {
29
 
30
  $minLen = 1;
31
  $maxLen = $max_length_value;
32
-
33
- $submit = $_POST['submit'];
34
 
35
  $action = "";
36
  $field_order = "";
@@ -40,16 +40,26 @@ function cimy_admin_define_extra_fields() {
40
  $action = "options";
41
  $res = cimy_save_options();
42
  }
43
- else if (!stristr($submit, $add_caption) === false)
44
  $action = "add";
45
- else if (!stristr($submit, $edit_caption) === false)
 
 
46
  $action = "edit";
47
- else if (!stristr($submit, $del_caption) === false)
 
 
48
  $action = "del";
49
- else if (!stristr($submit, $delSel_caption) === false)
 
 
50
  $action = "delSel";
51
- else if (!stristr($submit, $order_caption) === false)
 
 
52
  $action = "order";
 
 
53
 
54
  if (!isset($res))
55
  $res = array();
@@ -261,6 +271,15 @@ function cimy_admin_define_extra_fields() {
261
  $show_in_aeu = $_POST['show_in_aeu'.$field_order];
262
  $show_in_aeu == "1" ? $store_rule['show_in_aeu'] = true : $store_rule['show_in_aeu'] = false;
263
 
 
 
 
 
 
 
 
 
 
264
  // START CHECKING FOR ERRORS
265
  if ($name == "")
266
  $errors['name'] = __("Name not specified", $cimy_uef_domain);
@@ -455,6 +474,14 @@ function cimy_admin_define_extra_fields() {
455
 
456
  if ($store_rule['max_length'] == 0)
457
  unset($store_rule['max_length']);
 
 
 
 
 
 
 
 
458
 
459
  if ($action == "add") {
460
  // CAN BE MODIFIED OR NOT
@@ -549,10 +576,34 @@ function cimy_admin_define_extra_fields() {
549
  $selected_input["email"] = ' checked="checked"';
550
  else
551
  $selected_input["email"] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  }
553
  // action is not "add"
554
- else
555
  $selected_input["ok_edit"] = ' selected="selected"';
 
 
556
 
557
  // CAN BE EMPTY
558
  if (($store_rule['can_be_empty'] == true) || ($action != "add"))
@@ -572,13 +623,24 @@ function cimy_admin_define_extra_fields() {
572
  else
573
  $selected_input["show_in_profile"] = '';
574
 
575
-
576
  // SHOW IN AUTHORS AND USERS EXTENDED
577
  if ((!isset($store_rule['show_in_aeu'])) || ($store_rule['show_in_aeu'] == true) || ($action != "add"))
578
  $selected_input["show_in_aeu"] = ' checked="checked"';
579
  else
580
  $selected_input["show_in_aeu"] = '';
581
-
 
 
 
 
 
 
 
 
 
 
 
 
582
  $selected_input["name"] = attribute_escape($selected_input["name"]);
583
  $selected_input["value"] = attribute_escape($selected_input["value"]);
584
  $selected_input["label"] = attribute_escape($selected_input["label"]);
@@ -595,6 +657,7 @@ function cimy_admin_define_extra_fields() {
595
  <li><?php _e("With <strong>picture-url</strong>: you can preload a default image putting url in <em>Value</em>; <em>equal TO</em> means max width pixel size (height will be proportional)", $cimy_uef_domain); ?></li>
596
  <li><?php _e("With <strong>registration-date</strong>: <em>equal TO</em> means date and time format", $cimy_uef_domain); ?></li>
597
  <li><?php _e("With <strong>avatar</strong>: you can preload a default image putting url in <em>Value</em>; 'min,exact,max size' are in KB; <em>equal TO</em> is automatically set to 512 pixels", $cimy_uef_domain); ?></li>
 
598
  </ul>
599
  <br />
600
 
@@ -678,11 +741,29 @@ function cimy_admin_define_extra_fields() {
678
 
679
  <!-- SHOW IN A&U EXTENDED -->
680
  <input type="checkbox" name="show_in_aeu" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in A&amp;U Extended menu", $cimy_uef_domain); ?><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  </td>
682
  <td align="center" style="vertical-align: middle;">
683
  <p class="submit" style="border-width: 0px;">
684
  <input name="reset" type="reset" value="<?php _e("Clear", $cimy_uef_domain); ?>" /><br /><br />
685
- <input class="button-primary" name="submit" type="submit" value="<?php echo $add_caption ?>" />
686
  </p>
687
  </td>
688
  </tr>
@@ -702,7 +783,7 @@ function cimy_admin_define_extra_fields() {
702
  }
703
 
704
  function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
705
- global $cimy_uef_domain, $rule_maxlen, $rule_email, $rule_canbeempty, $rule_equalto, $rule_equalto_case_sensitive, $available_types, $max_length_name, $max_length_label, $max_length_desc, $max_length_value, $max_size_file, $cimy_uef_file_types, $is_mu, $rule_equalto_regex;
706
 
707
  if (!cimy_check_admin("manage_options"))
708
  return;
@@ -728,6 +809,9 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
728
  $del_caption = $submit_msgs['del_caption'];
729
  $delSel_caption = $submit_msgs['delSel_caption'];
730
  $order_caption = $submit_msgs['order_caption'];
 
 
 
731
 
732
  ?>
733
  <div class="wrap" id="<?php echo $div_id; ?>">
@@ -750,11 +834,11 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
750
  else {
751
  ?>
752
  <p class="submit" style="border-width: 0px; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
753
- <input type="button" value="<?php _e("Invert selection", $cimy_uef_domain); ?>" onclick="this.value=invert_sel('<?php echo $form_id; ?>', 'check', '<?php _e("Invert selection", $cimy_uef_domain); ?>')" />
754
- <input name="submit" type="submit" value="<?php echo $order_caption ?>" />
755
 
756
  <?php if (!$wp_fields) { ?>
757
- <input name="submit" type="submit" value="<?php echo $delSel_caption ?>" onclick="return confirm('<?php _e("Are you sure you want to delete field(s) and all data inserted into by users?", $cimy_uef_domain); ?>');" />
758
  <?php } ?>
759
  </p>
760
 
@@ -930,7 +1014,46 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
930
  $show_in_aeu = ' checked="checked"';
931
  else
932
  $show_in_aeu = "";
933
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  if (in_array($type, $cimy_uef_file_types)) {
935
  $min_length_caption = __("Min size", $cimy_uef_domain)." (KB)";
936
  $exact_length_caption = __("Exact size", $cimy_uef_domain)." (KB)";
@@ -1034,18 +1157,42 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
1034
  <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 />
1035
 
1036
  <!-- SHOW IN PROFILE -->
1037
- <input type="checkbox" name="show_in_profile<?php echo $order ?>" value="1"<?php echo $show_in_profile ?> /> <?php _e("Show the field in User's profile", $cimy_uef_domain); ?><br />
1038
-
 
 
 
 
 
 
1039
  <!-- SHOW IN A&U EXTENDED -->
1040
  <input type="checkbox" name="show_in_aeu<?php echo $order ?>" value="1"<?php echo $show_in_aeu ?> /> <?php _e("Show the field in A&amp;U Extended menu", $cimy_uef_domain); ?><br />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1041
  </td>
1042
  <td align="center" style="vertical-align: middle;">
1043
  <p class="submit" style="border-width: 0px;">
1044
  <input name="reset" type="reset" value="<?php _e("Reset", $cimy_uef_domain); ?>" /><br /><br />
1045
- <input class="button-primary" name="submit" type="submit" value="<?php echo $edit_caption." #".$order ?>" /><br /><br />
1046
 
1047
  <?php if (!$wp_fields) { ?>
1048
- <input name="submit" type="submit" value="<?php echo $del_caption." #".$order ?>" onclick="return confirm('<?php _e("Are you sure you want to delete field(s) and all data inserted into by users?", $cimy_uef_domain); ?>');" />
1049
  <?php } ?>
1050
  </p>
1051
  </td>
@@ -1056,11 +1203,11 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
1056
  </tbody>
1057
  </table>
1058
  <p class="submit" style="border-width: 0px; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
1059
- <input type="button" value="<?php _e("Invert selection", $cimy_uef_domain); ?>" onclick="this.value=invert_sel('<?php echo $form_id; ?>', 'check', '<?php _e("Invert selection", $cimy_uef_domain); ?>')" />
1060
- <input name="submit" type="submit" value="<?php echo $order_caption ?>" />
1061
 
1062
  <?php if (!$wp_fields) { ?>
1063
- <input name="submit" type="submit" value="<?php echo $delSel_caption ?>" onclick="return confirm('<?php _e("Are you sure you want to delete field(s) and all data inserted into by users?", $cimy_uef_domain); ?>');" />
1064
  <?php } ?>
1065
  </p>
1066
  <br />
@@ -1081,23 +1228,19 @@ function cimy_admin_users_list_page() {
1081
  if (!cimy_check_admin('edit_users'))
1082
  return;
1083
 
1084
- if ($is_mu)
1085
- $options = get_site_option($cimy_uef_options);
1086
- else
1087
- $options = get_option($cimy_uef_options);
1088
 
1089
  if (isset($_POST["cimy_uef_users_per_page"])) {
1090
  $users_per_page = $_POST["cimy_uef_users_per_page"];
1091
  $options["users_per_page"] = $users_per_page;
1092
 
1093
- if ($is_mu)
1094
- update_site_option($cimy_uef_options, $options);
1095
- else
1096
- update_option($cimy_uef_options, $options);
1097
  }
1098
  else
1099
  $users_per_page = $options["users_per_page"];
1100
-
 
 
1101
  $extra_fields = get_cimyFields();
1102
 
1103
  // yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it!
@@ -1108,7 +1251,7 @@ function cimy_admin_users_list_page() {
1108
  $this->page = (int) ( '' == $page ) ? 1 : $page;
1109
  $this->role = $role;
1110
  $this->users_per_page = intval($users_per_page);
1111
-
1112
  $this->prepare_query();
1113
  $this->query();
1114
  $this->prepare_vars_for_template_usage();
@@ -1126,27 +1269,28 @@ function cimy_admin_users_list_page() {
1126
  $wp_user_search = new Cimy_User_Search($_POST['usersearch'], $_GET['userspage'], $_GET['role'], $users_per_page);
1127
 
1128
  $search_result = $wp_user_search->get_results();
1129
-
1130
  // search into extra field engine
1131
  $i = 0;
 
1132
  foreach ($search_result as $userid) {
1133
  foreach ($extra_fields as $ef) {
1134
  $ef_id = $ef["ID"];
1135
  $ef_type = $ef["TYPE"];
1136
  $ef_name = $ef["NAME"];
1137
-
1138
  $ef_search = "";
1139
 
1140
  if (isset($_POST["ef_search"][$ef_name])) {
1141
  $ef_search = $_POST["ef_search"][$ef_name];
1142
  }
1143
-
1144
  if ($ef_search != "") {
1145
  $remove = false;
1146
 
1147
  $ef_value = $wpdb->get_var("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$userid." AND FIELD_ID=".$ef_id);
1148
-
1149
- if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url")) {
1150
  if (stristr($ef_value, $ef_search) === FALSE) {
1151
  $remove = true;
1152
  }
@@ -1159,9 +1303,20 @@ function cimy_admin_users_list_page() {
1159
  $remove = true;
1160
  }
1161
  } else if ($ef_type == "dropdown") {
 
 
 
 
1162
  if ($ef_search != $ef_value) {
1163
  $remove = true;
1164
  }
 
 
 
 
 
 
 
1165
  }
1166
 
1167
  if ($remove) {
@@ -1174,7 +1329,7 @@ function cimy_admin_users_list_page() {
1174
 
1175
  $i++;
1176
  }
1177
-
1178
  $wp_user_search->paging_text = "";
1179
  // oh yeah baby, now it's time for paging!
1180
  $wp_user_search->do_paging();
@@ -1281,7 +1436,7 @@ function cimy_admin_users_list_page() {
1281
  <?php _e("Users per page", $cimy_uef_domain); ?>
1282
  <select name="cimy_uef_users_per_page">
1283
  <?php
1284
- $users_per_page_list = array(10, 50, 100, 500);
1285
 
1286
  foreach ($users_per_page_list as $item) {
1287
  echo "<option";
@@ -1354,8 +1509,14 @@ function cimy_admin_users_list_page() {
1354
 
1355
  $search_input = "";
1356
  $search_value = "";
1357
- $search_value = attribute_escape(stripslashes($_POST["ef_search"][$name]));
1358
-
 
 
 
 
 
 
1359
  $thead_str.= "<th scope=\"col\" class=\"manage-column\" style=\"\">";
1360
  $tfoot_str.= "<th scope=\"col\" class=\"manage-column\" style=\"\">";
1361
 
@@ -1364,13 +1525,20 @@ function cimy_admin_users_list_page() {
1364
  $ret = cimy_dropDownOptions($label, $search_value);
1365
  $label = $ret['label'];
1366
 
1367
- $search_input = '<select name="ef_search['.$name.']"><option>--- select ---</option>'.$ret['html'].'</select>';
 
 
 
 
 
 
1368
  break;
1369
  case "text":
1370
  case "textarea":
1371
  case "textarea-rich":
1372
  case "picture":
1373
  case "picture-url":
 
1374
  $search_input = '<input type="text" name="ef_search['.$name.']" value="'.$search_value.'" size="6" />';
1375
  break;
1376
  case "checkbox":
@@ -1519,7 +1687,7 @@ function cimy_admin_users_list_page() {
1519
 
1520
  if ($field != "") {
1521
  if (intval($rules['equal_to'])) {
1522
- echo '<a href="'.$field.'">';
1523
  echo '<img src="'.$field.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
1524
  echo "</a>";
1525
  }
@@ -1543,19 +1711,25 @@ function cimy_admin_users_list_page() {
1543
 
1544
  $value_thumb = cimy_get_thumb_path($field);
1545
  $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($field));
1546
-
 
1547
  echo "\n\t\t";
1548
 
1549
  if (is_file($file_thumb)) {
1550
- echo '<a href="'.$field.'"><img src="'.$value_thumb.'" alt="picture" /></a><br />';
1551
  echo "\n\t\t";
1552
  }
1553
- else {
1554
  echo '<img src="'.$field.'" alt="picture" /><br />';
1555
- echo "\n\t\t";
1556
  }
1557
  }
1558
  }
 
 
 
 
 
1559
  else if ($type == "registration-date") {
1560
  if (isset($rules['equal_to']))
1561
  $registration_date = cimy_get_formatted_date($field, $rules['equal_to']);
29
 
30
  $minLen = 1;
31
  $maxLen = $max_length_value;
32
+
33
+ $submit = "";
34
 
35
  $action = "";
36
  $field_order = "";
40
  $action = "options";
41
  $res = cimy_save_options();
42
  }
43
+ else if ((isset($_POST["submit_add"])) && ($_POST["submit_add"] != "")) {
44
  $action = "add";
45
+ $submit = $_POST["submit_add"];
46
+ }
47
+ else if ((isset($_POST["submit_edit"])) && ($_POST["submit_edit"] != "")) {
48
  $action = "edit";
49
+ $submit = $_POST["submit_edit"];
50
+ }
51
+ else if ((isset($_POST["submit_del"])) && ($_POST["submit_del"] != "")) {
52
  $action = "del";
53
+ $submit = $_POST["submit_del"];
54
+ }
55
+ else if ((isset($_POST["submit_del_sel"])) && ($_POST["submit_del_sel"] != "")) {
56
  $action = "delSel";
57
+ $submit = $_POST["submit_del_sel"];
58
+ }
59
+ else if ((isset($_POST["submit_order"])) && ($_POST["submit_order"] != "")) {
60
  $action = "order";
61
+ $submit = $_POST["submit_order"];
62
+ }
63
 
64
  if (!isset($res))
65
  $res = array();
271
  $show_in_aeu = $_POST['show_in_aeu'.$field_order];
272
  $show_in_aeu == "1" ? $store_rule['show_in_aeu'] = true : $store_rule['show_in_aeu'] = false;
273
 
274
+ $show_in_search = $_POST['show_in_search'.$field_order];
275
+ $show_in_search == "1" ? $store_rule['show_in_search'] = true : $store_rule['show_in_search'] = false;
276
+
277
+ $show_in_blog = $_POST['show_in_blog'.$field_order];
278
+ $show_in_blog == "1" ? $store_rule['show_in_blog'] = true : $store_rule['show_in_blog'] = false;
279
+
280
+ $show_level = $_POST['show_level'.$field_order];
281
+ $store_rule['show_level'] = $show_level;
282
+
283
  // START CHECKING FOR ERRORS
284
  if ($name == "")
285
  $errors['name'] = __("Name not specified", $cimy_uef_domain);
474
 
475
  if ($store_rule['max_length'] == 0)
476
  unset($store_rule['max_length']);
477
+
478
+ // SHOW LEVEL
479
+ $show_anonymous = '';
480
+ $show_subscriber = '';
481
+ $show_contributor = '';
482
+ $show_author = '';
483
+ $show_editor = '';
484
+ $show_admin = '';
485
 
486
  if ($action == "add") {
487
  // CAN BE MODIFIED OR NOT
576
  $selected_input["email"] = ' checked="checked"';
577
  else
578
  $selected_input["email"] = '';
579
+
580
+ // SHOW LEVEL
581
+ switch ($store_rule['show_level']) {
582
+ case '-1':
583
+ $show_anonymous = ' selected="selected"';
584
+ break;
585
+ case '0':
586
+ $show_subscriber = ' selected="selected"';
587
+ break;
588
+ case '1':
589
+ $show_contributor = ' selected="selected"';
590
+ break;
591
+ case '2':
592
+ $show_author = ' selected="selected"';
593
+ break;
594
+ case '5':
595
+ $show_editor = ' selected="selected"';
596
+ break;
597
+ case '8':
598
+ $show_admin = ' selected="selected"';
599
+ break;
600
+ }
601
  }
602
  // action is not "add"
603
+ else {
604
  $selected_input["ok_edit"] = ' selected="selected"';
605
+ $show_anonymous = ' selected="selected"';
606
+ }
607
 
608
  // CAN BE EMPTY
609
  if (($store_rule['can_be_empty'] == true) || ($action != "add"))
623
  else
624
  $selected_input["show_in_profile"] = '';
625
 
 
626
  // SHOW IN AUTHORS AND USERS EXTENDED
627
  if ((!isset($store_rule['show_in_aeu'])) || ($store_rule['show_in_aeu'] == true) || ($action != "add"))
628
  $selected_input["show_in_aeu"] = ' checked="checked"';
629
  else
630
  $selected_input["show_in_aeu"] = '';
631
+
632
+ // SHOW IN THE SEARCH
633
+ if ((!isset($store_rule['show_in_search'])) || ($store_rule['show_in_search'] == true) || ($action != "add"))
634
+ $selected_input["show_in_search"] = ' checked="checked"';
635
+ else
636
+ $selected_input["show_in_search"] = '';
637
+
638
+ // SHOW IN THE BLOG
639
+ if ((!isset($store_rule['show_in_blog'])) || ($store_rule['show_in_blog'] == true) || ($action != "add"))
640
+ $selected_input["show_in_blog"] = ' checked="checked"';
641
+ else
642
+ $selected_input["show_in_blog"] = '';
643
+
644
  $selected_input["name"] = attribute_escape($selected_input["name"]);
645
  $selected_input["value"] = attribute_escape($selected_input["value"]);
646
  $selected_input["label"] = attribute_escape($selected_input["label"]);
657
  <li><?php _e("With <strong>picture-url</strong>: you can preload a default image putting url in <em>Value</em>; <em>equal TO</em> means max width pixel size (height will be proportional)", $cimy_uef_domain); ?></li>
658
  <li><?php _e("With <strong>registration-date</strong>: <em>equal TO</em> means date and time format", $cimy_uef_domain); ?></li>
659
  <li><?php _e("With <strong>avatar</strong>: you can preload a default image putting url in <em>Value</em>; 'min,exact,max size' are in KB; <em>equal TO</em> is automatically set to 512 pixels", $cimy_uef_domain); ?></li>
660
+ <li><?php _e("With <strong>file</strong>: you can preload a default file putting url in <em>Value</em>; 'min,exact,max size' are in KB; under <em>equal TO</em> can be specified allowed extensions separated by comma, example: zip,pdf,doc", $cimy_uef_domain); ?></li>
661
  </ul>
662
  <br />
663
 
741
 
742
  <!-- SHOW IN A&U EXTENDED -->
743
  <input type="checkbox" name="show_in_aeu" value="1"<?php echo $selected_input["show_in_aeu"]; ?> /> <?php _e("Show the field in A&amp;U Extended menu", $cimy_uef_domain); ?><br />
744
+
745
+ <!-- SHOW IN THE SEARCH ENGINE -->
746
+ <input type="checkbox" name="show_in_search" value="1"<?php echo $selected_input["show_in_search"]; ?> /> <?php _e("Show the field in the search engine", $cimy_uef_domain); ?><br />
747
+
748
+ <!-- SHOW IN THE BLOG -->
749
+ <input type="checkbox" name="show_in_blog" value="1"<?php echo $selected_input["show_in_blog"]; ?> /> <?php _e("Show the field in the blog", $cimy_uef_domain); ?><br />
750
+
751
+ <!-- SHOW SECURITY LEVEL -->
752
+ <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
753
+ <select name="show_level<?php echo $order ?>">
754
+ <option value="-1"<?php echo $show_anonymous ?>><?php _e("Anonymous"); ?></option>
755
+ <option value="0"<?php echo $show_subscriber ?>><?php echo translate_user_role("Subscriber"); ?></option>
756
+ <option value="1"<?php echo $show_contributor ?>><?php echo translate_user_role("Contributor"); ?></option>
757
+ <option value="2"<?php echo $show_author ?>><?php echo translate_user_role("Author"); ?></option>
758
+ <option value="5"<?php echo $show_editor ?>><?php echo translate_user_role("Editor"); ?></option>
759
+ <option value="8"<?php echo $show_admin ?>><?php echo translate_user_role("Administrator"); ?></option>
760
+ </select>
761
+ <br />
762
  </td>
763
  <td align="center" style="vertical-align: middle;">
764
  <p class="submit" style="border-width: 0px;">
765
  <input name="reset" type="reset" value="<?php _e("Clear", $cimy_uef_domain); ?>" /><br /><br />
766
+ <input class="button-primary" name="submit_add" type="submit" value="<?php echo $add_caption ?>" />
767
  </p>
768
  </td>
769
  </tr>
783
  }
784
 
785
  function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields) {
786
+ global $wpdb, $cimy_uef_domain, $rule_maxlen, $rule_email, $rule_canbeempty, $rule_equalto, $rule_equalto_case_sensitive, $available_types, $max_length_name, $max_length_label, $max_length_desc, $max_length_value, $max_size_file, $cimy_uef_file_types, $is_mu, $rule_equalto_regex;
787
 
788
  if (!cimy_check_admin("manage_options"))
789
  return;
809
  $del_caption = $submit_msgs['del_caption'];
810
  $delSel_caption = $submit_msgs['delSel_caption'];
811
  $order_caption = $submit_msgs['order_caption'];
812
+
813
+ $invert_selection_label = $wpdb->escape(__("Invert selection", $cimy_uef_domain));
814
+ $delete_fields_label = $wpdb->escape(__("Are you sure you want to delete field(s) and all data inserted into by users?", $cimy_uef_domain));
815
 
816
  ?>
817
  <div class="wrap" id="<?php echo $div_id; ?>">
834
  else {
835
  ?>
836
  <p class="submit" style="border-width: 0px; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
837
+ <input type="button" value="<?php echo $invert_selection_label; ?>" onclick="this.value=invert_sel('<?php echo $form_id; ?>', 'check', '<?php echo $invert_selection_label; ?>')" />
838
+ <input name="submit_order" type="submit" value="<?php echo $order_caption ?>" />
839
 
840
  <?php if (!$wp_fields) { ?>
841
+ <input name="submit_del_sel" type="submit" value="<?php echo $delSel_caption ?>" onclick="return confirm('<?php echo $delete_fields_label; ?>');" />
842
  <?php } ?>
843
  </p>
844
 
1014
  $show_in_aeu = ' checked="checked"';
1015
  else
1016
  $show_in_aeu = "";
1017
+
1018
+ if ($rules['show_in_search'])
1019
+ $show_in_search = ' checked="checked"';
1020
+ else
1021
+ $show_in_search = "";
1022
+
1023
+ if ($rules['show_in_blog'])
1024
+ $show_in_blog = ' checked="checked"';
1025
+ else
1026
+ $show_in_blog = "";
1027
+
1028
+ // SHOW LEVEL
1029
+ $show_anonymous = '';
1030
+ $show_subscriber = '';
1031
+ $show_contributor = '';
1032
+ $show_author = '';
1033
+ $show_editor = '';
1034
+ $show_admin = '';
1035
+
1036
+ switch ($rules['show_level']) {
1037
+ case '-1':
1038
+ $show_anonymous = ' selected="selected"';
1039
+ break;
1040
+ case '0':
1041
+ $show_subscriber = ' selected="selected"';
1042
+ break;
1043
+ case '1':
1044
+ $show_contributor = ' selected="selected"';
1045
+ break;
1046
+ case '2':
1047
+ $show_author = ' selected="selected"';
1048
+ break;
1049
+ case '5':
1050
+ $show_editor = ' selected="selected"';
1051
+ break;
1052
+ case '8':
1053
+ $show_admin = ' selected="selected"';
1054
+ break;
1055
+ }
1056
+
1057
  if (in_array($type, $cimy_uef_file_types)) {
1058
  $min_length_caption = __("Min size", $cimy_uef_domain)." (KB)";
1059
  $exact_length_caption = __("Exact size", $cimy_uef_domain)." (KB)";
1157
  <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 />
1158
 
1159
  <!-- SHOW IN PROFILE -->
1160
+ <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 />
1161
+ <?php
1162
+ if ($wp_fields) {
1163
+ ?>
1164
+ <input name="show_in_profile<?php echo $order ?>" type="hidden" value="1" />
1165
+ <?php
1166
+ }
1167
+ ?>
1168
  <!-- SHOW IN A&U EXTENDED -->
1169
  <input type="checkbox" name="show_in_aeu<?php echo $order ?>" value="1"<?php echo $show_in_aeu ?> /> <?php _e("Show the field in A&amp;U Extended menu", $cimy_uef_domain); ?><br />
1170
+
1171
+ <!-- SHOW IN THE SEARCH -->
1172
+ <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 />
1173
+
1174
+ <!-- SHOW IN THE BLOG -->
1175
+ <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 />
1176
+
1177
+ <!-- SHOW SECURITY LEVEL -->
1178
+ <?php _e("Show the field if the role is at least:", $cimy_uef_domain)." "; ?>
1179
+ <select name="show_level<?php echo $order ?>">
1180
+ <option value="-1"<?php echo $show_anonymous ?>><?php _e("Anonymous"); ?></option>
1181
+ <option value="0"<?php echo $show_subscriber ?>><?php echo translate_user_role("Subscriber"); ?></option>
1182
+ <option value="1"<?php echo $show_contributor ?>><?php echo translate_user_role("Contributor"); ?></option>
1183
+ <option value="2"<?php echo $show_author ?>><?php echo translate_user_role("Author"); ?></option>
1184
+ <option value="5"<?php echo $show_editor ?>><?php echo translate_user_role("Editor"); ?></option>
1185
+ <option value="8"<?php echo $show_admin ?>><?php echo translate_user_role("Administrator"); ?></option>
1186
+ </select>
1187
+ <br />
1188
  </td>
1189
  <td align="center" style="vertical-align: middle;">
1190
  <p class="submit" style="border-width: 0px;">
1191
  <input name="reset" type="reset" value="<?php _e("Reset", $cimy_uef_domain); ?>" /><br /><br />
1192
+ <input class="button-primary" name="submit_edit" type="submit" value="<?php echo $edit_caption." #".$order ?>" /><br /><br />
1193
 
1194
  <?php if (!$wp_fields) { ?>
1195
+ <input name="submit_del" type="submit" value="<?php echo $del_caption." #".$order ?>" onclick="return confirm('<?php echo $delete_fields_label; ?>');" />
1196
  <?php } ?>
1197
  </p>
1198
  </td>
1203
  </tbody>
1204
  </table>
1205
  <p class="submit" style="border-width: 0px; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
1206
+ <input type="button" value="<?php echo $invert_selection_label; ?>" onclick="this.value=invert_sel('<?php echo $form_id; ?>', 'check', '<?php echo $invert_selection_label; ?>')" />
1207
+ <input name="submit_order" type="submit" value="<?php echo $order_caption ?>" />
1208
 
1209
  <?php if (!$wp_fields) { ?>
1210
+ <input name="submit_del_sel" type="submit" value="<?php echo $delSel_caption ?>" onclick="return confirm('<?php echo $delete_fields_label; ?>');" />
1211
  <?php } ?>
1212
  </p>
1213
  <br />
1228
  if (!cimy_check_admin('edit_users'))
1229
  return;
1230
 
1231
+ $options = cimy_get_options();
 
 
 
1232
 
1233
  if (isset($_POST["cimy_uef_users_per_page"])) {
1234
  $users_per_page = $_POST["cimy_uef_users_per_page"];
1235
  $options["users_per_page"] = $users_per_page;
1236
 
1237
+ cimy_set_options($options);
 
 
 
1238
  }
1239
  else
1240
  $users_per_page = $options["users_per_page"];
1241
+
1242
+ $dropdown_first_item = '--- '.__("select", $cimy_uef_domain).' ---';
1243
+
1244
  $extra_fields = get_cimyFields();
1245
 
1246
  // yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it!
1251
  $this->page = (int) ( '' == $page ) ? 1 : $page;
1252
  $this->role = $role;
1253
  $this->users_per_page = intval($users_per_page);
1254
+
1255
  $this->prepare_query();
1256
  $this->query();
1257
  $this->prepare_vars_for_template_usage();
1269
  $wp_user_search = new Cimy_User_Search($_POST['usersearch'], $_GET['userspage'], $_GET['role'], $users_per_page);
1270
 
1271
  $search_result = $wp_user_search->get_results();
1272
+
1273
  // search into extra field engine
1274
  $i = 0;
1275
+
1276
  foreach ($search_result as $userid) {
1277
  foreach ($extra_fields as $ef) {
1278
  $ef_id = $ef["ID"];
1279
  $ef_type = $ef["TYPE"];
1280
  $ef_name = $ef["NAME"];
1281
+
1282
  $ef_search = "";
1283
 
1284
  if (isset($_POST["ef_search"][$ef_name])) {
1285
  $ef_search = $_POST["ef_search"][$ef_name];
1286
  }
1287
+
1288
  if ($ef_search != "") {
1289
  $remove = false;
1290
 
1291
  $ef_value = $wpdb->get_var("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$userid." AND FIELD_ID=".$ef_id);
1292
+
1293
+ if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url") || ($ef_type == "file")) {
1294
  if (stristr($ef_value, $ef_search) === FALSE) {
1295
  $remove = true;
1296
  }
1303
  $remove = true;
1304
  }
1305
  } else if ($ef_type == "dropdown") {
1306
+ // if it is selected the "--- select ---" item then skip this check
1307
+ if ($ef_search == $dropdown_first_item)
1308
+ continue;
1309
+
1310
  if ($ef_search != $ef_value) {
1311
  $remove = true;
1312
  }
1313
+ } else if ($ef_type == "dropdown-multi") {
1314
+ // if it is selected the "--- select ---" item then remove it
1315
+ if ($ef_search[0] == $dropdown_first_item)
1316
+ unset($ef_search[0]);
1317
+
1318
+ if (count(array_diff($ef_search, explode(",", $ef_value))) != 0)
1319
+ $remove = true;
1320
  }
1321
 
1322
  if ($remove) {
1329
 
1330
  $i++;
1331
  }
1332
+
1333
  $wp_user_search->paging_text = "";
1334
  // oh yeah baby, now it's time for paging!
1335
  $wp_user_search->do_paging();
1436
  <?php _e("Users per page", $cimy_uef_domain); ?>
1437
  <select name="cimy_uef_users_per_page">
1438
  <?php
1439
+ $users_per_page_list = array(10, 50, 100, 500, 1000, 5000);
1440
 
1441
  foreach ($users_per_page_list as $item) {
1442
  echo "<option";
1509
 
1510
  $search_input = "";
1511
  $search_value = "";
1512
+
1513
+ if (!empty($_POST["ef_search"][$name])) {
1514
+ if ($type == "dropdown-multi")
1515
+ $search_value = attribute_escape(stripslashes(implode(",", $_POST["ef_search"][$name])));
1516
+ else
1517
+ $search_value = attribute_escape(stripslashes($_POST["ef_search"][$name]));
1518
+ }
1519
+
1520
  $thead_str.= "<th scope=\"col\" class=\"manage-column\" style=\"\">";
1521
  $tfoot_str.= "<th scope=\"col\" class=\"manage-column\" style=\"\">";
1522
 
1525
  $ret = cimy_dropDownOptions($label, $search_value);
1526
  $label = $ret['label'];
1527
 
1528
+ $search_input = '<select name="ef_search['.$name.']"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
1529
+ break;
1530
+ case "dropdown-multi":
1531
+ $ret = cimy_dropDownOptions($label, $search_value);
1532
+ $label = $ret['label'];
1533
+
1534
+ $search_input = '<select name="ef_search['.$name.'][]" multiple="multiple" style="height: 6em;"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
1535
  break;
1536
  case "text":
1537
  case "textarea":
1538
  case "textarea-rich":
1539
  case "picture":
1540
  case "picture-url":
1541
+ case "file":
1542
  $search_input = '<input type="text" name="ef_search['.$name.']" value="'.$search_value.'" size="6" />';
1543
  break;
1544
  case "checkbox":
1687
 
1688
  if ($field != "") {
1689
  if (intval($rules['equal_to'])) {
1690
+ echo '<a target="_blank" href="'.$field.'">';
1691
  echo '<img src="'.$field.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
1692
  echo "</a>";
1693
  }
1711
 
1712
  $value_thumb = cimy_get_thumb_path($field);
1713
  $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($field));
1714
+ $file_on_server = $cuef_upload_path.$user_login."/".basename($field);
1715
+
1716
  echo "\n\t\t";
1717
 
1718
  if (is_file($file_thumb)) {
1719
+ echo '<a target="_blank" href="'.$field.'"><img src="'.$value_thumb.'" alt="picture" /></a><br />';
1720
  echo "\n\t\t";
1721
  }
1722
+ else if (is_file($file_on_server)) {
1723
  echo '<img src="'.$field.'" alt="picture" /><br />';
1724
+ echo "\n\t\t";
1725
  }
1726
  }
1727
  }
1728
+ else if ($type == "file") {
1729
+ echo '<a target="_blank" href="'.$field.'">';
1730
+ echo basename($field);
1731
+ echo '</a>';
1732
+ }
1733
  else if ($type == "registration-date") {
1734
  if (isset($rules['equal_to']))
1735
  $registration_date = cimy_get_formatted_date($field, $rules['equal_to']);
cimy_uef_db.php CHANGED
@@ -128,6 +128,45 @@ function cimy_plugin_install () {
128
  $wpdb->query($sql);
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  $options['version'] = $cimy_uef_version;
132
 
133
  cimy_set_options($options);
@@ -244,6 +283,57 @@ function cimy_manage_db($command) {
244
  }
245
  }
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  function cimy_delete_users_info($fields_id) {
248
  global $wpdb, $wpdb_data_table;
249
 
@@ -260,44 +350,6 @@ function cimy_delete_user_info($user_id) {
260
  if (!current_user_can('edit_user', $user_id))
261
  return;
262
 
263
- // function to delete all files/subdirs in a path
264
- // taken from PHP unlink's documentation comment by torch - torchsdomain dot com @ 22-Nov-2006 09:27
265
- // modified by Marco Cimmino to delete correctly call recursion before so can also delete subdirs when empty
266
- if (!function_exists(cimy_rfr)) {
267
- function cimy_rfr($path, $match) {
268
- static $deld = 0, $dsize = 0;
269
-
270
- // remember that glob returns FALSE in case of error
271
- $dirs = glob($path."*");
272
- $files = glob($path.$match);
273
-
274
- // call recursion before so we delete files in subdirs first!
275
- if (is_array($dirs)) {
276
- foreach ($dirs as $dir) {
277
- if (is_dir($dir)) {
278
- $dir = basename($dir) . "/";
279
- cimy_rfr($path.$dir, $match);
280
- }
281
- }
282
- }
283
-
284
- if (is_array($files)) {
285
- foreach ($files as $file) {
286
- if (is_file($file)) {
287
- $dsize += filesize($file);
288
- unlink($file);
289
- $deld++;
290
- }
291
- else if (is_dir($file)) {
292
- rmdir($file);
293
- }
294
- }
295
- }
296
-
297
- return "$deld files deleted with a total size of $dsize bytes";
298
- }
299
- }
300
-
301
  $sql = "DELETE FROM ".$wpdb_data_table." WHERE USER_ID=".$user_id;
302
  $wpdb->query($sql);
303
 
@@ -327,9 +379,9 @@ function cimy_insert_ExtraFields_if_not_exist($user_id, $field_id) {
327
  }
328
 
329
  function cimy_get_options() {
330
- global $is_mu, $cimy_uef_options;
331
 
332
- if ($is_mu)
333
  $options = get_site_option($cimy_uef_options);
334
  else
335
  $options = get_option($cimy_uef_options);
@@ -338,9 +390,9 @@ function cimy_get_options() {
338
  }
339
 
340
  function cimy_set_options($options) {
341
- global $is_mu, $cimy_uef_options, $cimy_uef_options_descr;
342
 
343
- if ($is_mu)
344
  update_site_option($cimy_uef_options, $options);
345
  else
346
  update_option($cimy_uef_options, $options, $cimy_uef_options_descr, "no");
128
  $wpdb->query($sql);
129
  }
130
 
131
+ if (version_compare($options['version'], "1.4.0", "<=") === true) {
132
+ $sql = "ALTER TABLE ".$wpdb_data_table." MODIFY COLUMN VALUE LONGTEXT";
133
+ $wpdb->query($sql);
134
+ }
135
+
136
+
137
+ // add $rules[show_in_blog]=true and $rules[show_level]=-1
138
+ if (version_compare($options['version'], "1.5.0-beta1", "<=") === true) {
139
+ for ($i = 0; $i <= 1; $i++) {
140
+ if ($i == 0)
141
+ $the_table = $wpdb_wp_fields_table;
142
+ else
143
+ $the_table = $wpdb_fields_table;
144
+
145
+ $sql = "SELECT ID, RULES FROM ".$the_table;
146
+ $all_rules = $wpdb->get_results($sql, ARRAY_A);
147
+
148
+ if (isset($all_rules)) {
149
+ foreach ($all_rules as $rule) {
150
+ $rule_to_be_updated = unserialize($rule["RULES"]);
151
+ $rule_id = $rule["ID"];
152
+
153
+ // do not add show_level to $wpdb_wp_fields_table
154
+ if ((!isset($rule_to_be_updated["show_level"])) && ($i == 1))
155
+ $rule_to_be_updated["show_level"] = -1;
156
+
157
+ if (!isset($rule_to_be_updated["show_in_blog"]))
158
+ $rule_to_be_updated["show_in_blog"] = true;
159
+
160
+ if (!isset($rule_to_be_updated["show_in_search"]))
161
+ $rule_to_be_updated["show_in_search"] = true;
162
+
163
+ $sql = "UPDATE ".$the_table." SET RULES='".$wpdb->escape(serialize($rule_to_be_updated))."' WHERE ID=".$rule_id;
164
+ $wpdb->query($sql);
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
  $options['version'] = $cimy_uef_version;
171
 
172
  cimy_set_options($options);
283
  }
284
  }
285
 
286
+ // function to delete all files/subdirs in a path
287
+ // taken from PHP unlink's documentation comment by torch - torchsdomain dot com @ 22-Nov-2006 09:27
288
+ // modified by Marco Cimmino to delete correctly call recursion before so can also delete subdirs when empty
289
+ if (!function_exists(cimy_rfr)) {
290
+ function cimy_rfr($path, $match) {
291
+ static $deld = 0, $dsize = 0;
292
+
293
+ // remember that glob returns FALSE in case of error
294
+ $dirs = glob($path."*");
295
+ $files = glob($path.$match);
296
+
297
+ // call recursion before so we delete files in subdirs first!
298
+ if (is_array($dirs)) {
299
+ foreach ($dirs as $dir) {
300
+ if (is_dir($dir)) {
301
+ $dir = basename($dir) . "/";
302
+ cimy_rfr($path.$dir, $match);
303
+ }
304
+ }
305
+ }
306
+
307
+ if (is_array($files)) {
308
+ foreach ($files as $file) {
309
+ if (is_file($file)) {
310
+ $dsize += filesize($file);
311
+ unlink($file);
312
+ $deld++;
313
+ }
314
+ else if (is_dir($file)) {
315
+ rmdir($file);
316
+ }
317
+ }
318
+ }
319
+
320
+ return "$deld files deleted with a total size of $dsize bytes";
321
+ }
322
+ }
323
+
324
+ function cimy_delete_blog_info($blog_id, $drop) {
325
+ global $cuef_upload_path;
326
+
327
+ $file_path = $cuef_upload_path.$blog_id."/";
328
+
329
+ // delete all uploaded files for that users
330
+ cimy_rfr($file_path, "*");
331
+
332
+ // delete also the subdir
333
+ if (is_dir($file_path))
334
+ rmdir($file_path);
335
+ }
336
+
337
  function cimy_delete_users_info($fields_id) {
338
  global $wpdb, $wpdb_data_table;
339
 
350
  if (!current_user_can('edit_user', $user_id))
351
  return;
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  $sql = "DELETE FROM ".$wpdb_data_table." WHERE USER_ID=".$user_id;
354
  $wpdb->query($sql);
355
 
379
  }
380
 
381
  function cimy_get_options() {
382
+ global $is_mu, $cimy_uef_options, $cimy_uef_plugins_dir;
383
 
384
+ if (($is_mu) && ($cimy_uef_plugins_dir == "mu-plugins"))
385
  $options = get_site_option($cimy_uef_options);
386
  else
387
  $options = get_option($cimy_uef_options);
390
  }
391
 
392
  function cimy_set_options($options) {
393
+ global $is_mu, $cimy_uef_options, $cimy_uef_options_descr, $cimy_uef_plugins_dir;
394
 
395
+ if (($is_mu) && ($cimy_uef_plugins_dir == "mu-plugins"))
396
  update_site_option($cimy_uef_options, $options);
397
  else
398
  update_option($cimy_uef_options, $options, $cimy_uef_options_descr, "no");
cimy_uef_functions.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  function get_cimyFields($wp_fields=false, $order_by_section=false) {
4
  global $wpdb_fields_table, $wpdb_wp_fields_table, $wpdb;
5
-
6
  if ($wp_fields)
7
  $table = $wpdb_wp_fields_table;
8
  else
@@ -81,8 +81,7 @@ function get_cimyFieldValue($user_id, $field_name, $field_value=false) {
81
  efields.TYPE,
82
  data.VALUE
83
 
84
- FROM <wp users table> as users,
85
- <uef data table> as data
86
 
87
  JOIN <uef fields table> as efields
88
 
@@ -94,7 +93,7 @@ function get_cimyFieldValue($user_id, $field_name, $field_value=false) {
94
  AND (efields.TYPE!='radio' OR data.VALUE!='')
95
  [AND data.VALUE=<field_value>]
96
  */
97
- $sql = "SELECT efields.LABEL, efields.TYPE, data.VALUE FROM ".$wpdb->users." as users, ".$wpdb_data_table." as data JOIN ".$wpdb_fields_table." as efields ON efields.id=data.field_id WHERE efields.name='".$field_name."' AND data.USER_ID=".$user_id." AND efields.TYPE!='password' AND (efields.TYPE!='radio' OR data.VALUE!='')".$sql_field_value;
98
  }
99
 
100
  // only USER_ID provided
@@ -207,7 +206,7 @@ function cimy_change_radio_labels($field_data) {
207
  if ($field_data[$i]['TYPE'] == "radio") {
208
  $field_data[$i]['VALUE'] = $field_data[$i]['LABEL'];
209
  }
210
- else if ($field_data[$i]['TYPE'] == "dropdown") {
211
  $ret = cimy_dropDownOptions($field_data[$i]['LABEL'], false);
212
 
213
  $field_data[$i]['LABEL'] = $ret['label'];
@@ -248,8 +247,10 @@ function cimy_dropDownOptions($values, $selected) {
248
  else
249
  $label = "";
250
 
251
- $items = explode(",",$values);
 
252
  $html_options = "";
 
253
 
254
  foreach ($items as $item) {
255
  $item_clean = trim($item, "\t\n\r");
@@ -257,9 +258,12 @@ function cimy_dropDownOptions($values, $selected) {
257
  $html_options.= "\n\t\t\t";
258
  $html_options.= '<option value="'.$item_clean.'"';
259
 
260
- if (isset($selected))
261
- if ($selected == $item_clean)
 
262
  $html_options.= ' selected="selected"';
 
 
263
 
264
  $html_options.= ">".$item_clean."</option>";
265
  }
@@ -298,9 +302,9 @@ function cimy_uef_sanitize_content($content, $override_allowed_tags=null) {
298
  }
299
 
300
  function cimy_check_admin($permission) {
301
- global $is_mu;
302
 
303
- if ($is_mu)
304
  return is_site_admin();
305
  else
306
  return current_user_can($permission);
2
 
3
  function get_cimyFields($wp_fields=false, $order_by_section=false) {
4
  global $wpdb_fields_table, $wpdb_wp_fields_table, $wpdb;
5
+
6
  if ($wp_fields)
7
  $table = $wpdb_wp_fields_table;
8
  else
81
  efields.TYPE,
82
  data.VALUE
83
 
84
+ FROM <uef data table> as data
 
85
 
86
  JOIN <uef fields table> as efields
87
 
93
  AND (efields.TYPE!='radio' OR data.VALUE!='')
94
  [AND data.VALUE=<field_value>]
95
  */
96
+ $sql = "SELECT efields.LABEL, efields.TYPE, data.VALUE FROM ".$wpdb_data_table." as data JOIN ".$wpdb_fields_table." as efields ON efields.id=data.field_id WHERE efields.name='".$field_name."' AND data.USER_ID=".$user_id." AND efields.TYPE!='password' AND (efields.TYPE!='radio' OR data.VALUE!='')".$sql_field_value;
97
  }
98
 
99
  // only USER_ID provided
206
  if ($field_data[$i]['TYPE'] == "radio") {
207
  $field_data[$i]['VALUE'] = $field_data[$i]['LABEL'];
208
  }
209
+ else if (($field_data[$i]['TYPE'] == "dropdown") || ($field_data[$i]['TYPE'] == "dropdown-multi")) {
210
  $ret = cimy_dropDownOptions($field_data[$i]['LABEL'], false);
211
 
212
  $field_data[$i]['LABEL'] = $ret['label'];
247
  else
248
  $label = "";
249
 
250
+ $items = explode(",", $values);
251
+ $sel_items = explode(",", $selected);
252
  $html_options = "";
253
+ $sel_i = 0;
254
 
255
  foreach ($items as $item) {
256
  $item_clean = trim($item, "\t\n\r");
258
  $html_options.= "\n\t\t\t";
259
  $html_options.= '<option value="'.$item_clean.'"';
260
 
261
+ if (isset($sel_items[$sel_i])) {
262
+ if ($sel_items[$sel_i] == $item_clean) {
263
+ $sel_i++;
264
  $html_options.= ' selected="selected"';
265
+ }
266
+ }
267
 
268
  $html_options.= ">".$item_clean."</option>";
269
  }
302
  }
303
 
304
  function cimy_check_admin($permission) {
305
+ global $is_mu, $cimy_uef_plugins_dir;
306
 
307
+ if (($is_mu) && ($cimy_uef_plugins_dir == "mu-plugins"))
308
  return is_site_admin();
309
  else
310
  return current_user_can($permission);
cimy_uef_mu_activation.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ This file is required only if you are installing Cimy User Extra Fields
4
+ under WordPress MU /plugins/ directory.
5
+ Unluckily WordPress MU is designed to disable ALL /plugins/* when
6
+ activating a new user/blog, preventing Cimy User Extra Fields to correctly
7
+ save extra fields data in that phase.
8
+
9
+ If you installed Cimy User Extra Fields instead under /mu-plugins/ directory
10
+ IGNORE this file!
11
+ */
12
+ // need to know if registering with VHOST set to 'yes', as seems filters are not added in time, grr!
13
+ if (constant( "VHOST" ) == 'yes')
14
+ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
15
+ else
16
+ $action = "";
17
+
18
+ if (isset($_REQUEST["blog_id"])) {
19
+ $mu_blog_id = intval($_REQUEST["blog_id"]);
20
+
21
+ if (cimy_uef_mu_blog_exists($mu_blog_id) /*&& ($_REQUEST["stage"] != "validate-blog-signup")*/) {
22
+ switch_to_blog($mu_blog_id);
23
+ }
24
+ }
25
+
26
+ // Leave this after all!
27
+ if ((defined('WP_INSTALLING')) || ($action == "register"))
28
+ require_once(ABSPATH.PLUGINDIR."/cimy-user-extra-fields/cimy_user_extra_fields.php");
29
+
30
+ function cimy_uef_mu_blog_exists($blog_id, $c_site_id=-1) {
31
+ global $wpdb, $site_id;
32
+
33
+ $blog_id = intval($blog_id);
34
+ $c_site_id = intval($c_site_id);
35
+
36
+ if ($c_site_id == -1)
37
+ $c_site_id = $site_id;
38
+
39
+ $sql = "SELECT blog_id FROM $wpdb->blogs WHERE blog_id=".$blog_id." AND site_id=".$c_site_id;
40
+ $id = $wpdb->get_var($sql);
41
+
42
+ // if exists any result then the blog exists too!
43
+ if (isset($id))
44
+ return true;
45
+
46
+ return false;
47
+ }
48
+
49
+ ?>
cimy_uef_options.php CHANGED
@@ -228,7 +228,7 @@ function cimy_save_options() {
228
  }
229
  }
230
 
231
- if (isset($_POST['show_wp_bio_info'])) {
232
  array_push($options['wp_hidden_fields'], 'bio-info');
233
 
234
  if (!in_array("bio-info", $old_wp_hidden_fields)) {
@@ -397,6 +397,8 @@ function cimy_show_options($results, $embedded) {
397
 
398
  if ((isset($cimy_top_menu)) && ($embedded))
399
  return $ret;
 
 
400
 
401
  ?>
402
 
@@ -445,12 +447,12 @@ function cimy_show_options($results, $embedded) {
445
  ?><br /><h4><?php _e("OPTIONS DELETED!", $cimy_uef_domain); ?></h4>
446
  <input type="hidden" name="do_not_save_options" value="1" />
447
 
448
- <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?>" onclick="return confirm('<?php _e("This operation will create/update all missing tables/options, do you want to proceed?", $cimy_uef_domain); ?>');" /></p><?php
449
  }
450
  else if ($cimy_uef_version != $options['version']) {
451
  ?><br /><h4><?php _e("VERSIONS MISMATCH! This because you haven't de-activated and re-activated the plug-in after the update! This could give problems...", $cimy_uef_domain); ?></h4>
452
 
453
- <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?>" onclick="return confirm('<?php _e("This operation will create/update all missing tables/options, do you want to proceed?", $cimy_uef_domain); ?>');" /></p><?php
454
  }
455
  ?>
456
  </td>
@@ -632,7 +634,7 @@ function cimy_show_options($results, $embedded) {
632
  <td></td>
633
  </tr>
634
  <tr>
635
- <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>
636
  <td></td>
637
  </tr>
638
  </table>
228
  }
229
  }
230
 
231
+ if (isset($_POST['show_wp_bio-info'])) {
232
  array_push($options['wp_hidden_fields'], 'bio-info');
233
 
234
  if (!in_array("bio-info", $old_wp_hidden_fields)) {
397
 
398
  if ((isset($cimy_top_menu)) && ($embedded))
399
  return $ret;
400
+
401
+ $update_db_label = $wpdb->escape(__("This operation will create/update all missing tables/options, do you want to proceed?", $cimy_uef_domain));
402
 
403
  ?>
404
 
447
  ?><br /><h4><?php _e("OPTIONS DELETED!", $cimy_uef_domain); ?></h4>
448
  <input type="hidden" name="do_not_save_options" value="1" />
449
 
450
+ <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?>" onclick="return confirm('<?php echo $update_db_label; ?>');" /></p><?php
451
  }
452
  else if ($cimy_uef_version != $options['version']) {
453
  ?><br /><h4><?php _e("VERSIONS MISMATCH! This because you haven't de-activated and re-activated the plug-in after the update! This could give problems...", $cimy_uef_domain); ?></h4>
454
 
455
+ <p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="force_activation" value="<?php _e("Fix the problem", $cimy_uef_domain); ?>" onclick="return confirm('<?php echo $update_db_label; ?>');" /></p><?php
456
  }
457
  ?>
458
  </td>
634
  <td></td>
635
  </tr>
636
  <tr>
637
+ <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>
638
  <td></td>
639
  </tr>
640
  </table>
cimy_uef_profile.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  function cimy_extract_ExtraFields() {
4
- global $wpdb, $user_ID, $wpdb_data_table, $start_cimy_uef_comment, $end_cimy_uef_comment, $rule_profile_value, $cimy_uef_options, $rule_maxlen_needed, $fields_name_prefix, $cuef_upload_path, $is_mu, $cimy_uef_domain, $cuef_plugin_dir, $cimy_uef_file_types, $cimy_uef_textarea_types;
5
 
6
  // if editing a different user (only admin)
7
  if (isset($_GET['user_id'])) {
@@ -17,7 +17,7 @@ function cimy_extract_ExtraFields() {
17
 
18
  $get_user_id = $user_ID;
19
  }
20
-
21
  $options = cimy_get_options();
22
 
23
  $extra_fields = get_cimyFields(false, true);
@@ -43,7 +43,7 @@ function cimy_extract_ExtraFields() {
43
 
44
  $radio_checked = array();
45
 
46
- $current_fieldset = 0;
47
  $tiny_mce_objects = "";
48
 
49
  if ($options['fieldset_title'] != "")
@@ -51,8 +51,7 @@ function cimy_extract_ExtraFields() {
51
  else
52
  $fieldset_titles = array();
53
 
54
- if (isset($fieldset_titles[$current_fieldset]))
55
- echo "\n\t<h3>".$fieldset_titles[$current_fieldset]."</h3>\n";
56
 
57
  echo '<table class="form-table">';
58
  echo "\n";
@@ -68,339 +67,403 @@ function cimy_extract_ExtraFields() {
68
  $description = $thisField['DESCRIPTION'];
69
  $fieldset = $thisField['FIELDSET'];
70
  $input_name = $fields_name_prefix.attribute_escape($name);
71
-
72
- if ($rules['show_in_profile']) {
73
-
74
- foreach ($ef_db as $d_field) {
75
- if ($d_field['FIELD_ID'] == $field_id)
76
- $value = $d_field['VALUE'];
77
- }
78
 
79
- $old_value = $value;
80
-
81
- // if nothing is inserted and field admin default value then assign it
82
- if (in_array($type, $rule_profile_value)) {
83
- if ($value == "")
84
- $value = $thisField['VALUE'];
85
- }
86
 
87
- if (($fieldset > $current_fieldset) && (isset($fieldset_titles[$fieldset]))) {
88
- $current_fieldset = $fieldset;
 
 
 
 
89
 
90
- echo "</table>\n";
 
 
 
91
 
92
- if (isset($fieldset_titles[$current_fieldset]))
93
- echo "\n\t<h3>".$fieldset_titles[$current_fieldset]."</h3>\n";
94
-
95
- echo '<table class="form-table">';
96
- echo "\n";
97
- }
 
98
 
99
- echo "\t";
100
- echo "<tr>";
101
- echo "\n\t";
 
 
 
 
 
 
 
 
102
 
103
- $value = attribute_escape($value);
104
-
105
- switch($type) {
106
- case "picture-url":
107
- case "password":
108
- case "text":
109
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
110
- $obj_name = ' name="'.$input_name.'"';
111
-
112
- if ($type == "picture-url")
113
- $obj_type = ' type="text"';
114
- else
115
- $obj_type = ' type="'.$type.'"';
116
-
117
- $obj_value = ' value="'.$value.'"';
118
- $obj_value2 = "";
119
- $obj_checked = "";
120
- $obj_tag = "input";
121
- $obj_closing_tag = false;
122
- $obj_style = "";
123
-
124
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
125
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
126
- || ($rules['edit'] == 'no_edit')
127
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
128
- $obj_disabled = ' disabled="disabled"';
129
- else
130
- $obj_disabled = "";
131
-
132
- break;
133
-
134
- case "textarea":
135
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
136
- $obj_name = ' name="'.$input_name.'"';
137
- $obj_type = "";
138
- $obj_value = "";
139
- $obj_value2 = $value;
140
- $obj_checked = "";
141
- $obj_tag = "textarea";
142
- $obj_closing_tag = true;
143
- $obj_style = "";
144
-
145
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
146
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
147
- || ($rules['edit'] == 'no_edit')
148
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
149
- $obj_disabled = ' disabled="disabled"';
150
- else
151
- $obj_disabled = "";
152
-
153
- break;
154
-
155
- case "textarea-rich":
156
- if ($tiny_mce_objects == "")
157
- $tiny_mce_objects = $fields_name_prefix.$field_id;
158
- else
159
- $tiny_mce_objects .= ",".$fields_name_prefix.$field_id;
160
 
161
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
162
- $obj_name = ' name="'.$input_name.'"';
163
- $obj_type = "";
164
- $obj_value = "";
165
- $obj_value2 = $value;
166
- $obj_checked = "";
167
- $obj_tag = "textarea";
168
- $obj_closing_tag = true;
169
- $obj_style = "";
170
-
171
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
172
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
173
- || ($rules['edit'] == 'no_edit')
174
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
175
- $obj_disabled = ' disabled="disabled"';
176
- else
177
- $obj_disabled = "";
178
- break;
179
-
180
- case "dropdown":
181
- $ret = cimy_dropDownOptions($label, $value);
182
- $label = $ret['label'];
183
- $html = $ret['html'];
184
-
185
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
186
- $obj_name = ' name="'.$input_name.'"';
187
- $obj_type = '';
188
- $obj_value = '';
189
- $obj_value2 = $html;
190
- $obj_checked = "";
191
- $obj_tag = "select";
192
- $obj_closing_tag = true;
193
- $obj_style = "";
194
 
195
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
196
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
197
- || ($rules['edit'] == 'no_edit')
198
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
199
- $obj_disabled = ' disabled="disabled"';
200
- else
201
- $obj_disabled = "";
202
-
203
- break;
204
-
205
- case "checkbox":
206
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
207
- $obj_name = ' name="'.$input_name.'"';
208
- $obj_type = ' type="'.$type.'"';
209
- $obj_value = ' value="1"';
210
- $obj_value2 = "";
211
- $value == "YES" ? $obj_checked = ' checked="checked"' : $obj_checked = '';
212
- $obj_tag = "input";
213
- $obj_closing_tag = false;
214
- $obj_style = ' style="width:auto; border:0; background:white;"';
215
-
216
- if (($rules['edit'] == 'no_edit')
217
- || ((($rules['edit'] == 'edit_only_by_admin') || ($rules['edit'] == 'edit_only_by_admin_or_if_empty')) && (!current_user_can('edit_users'))))
218
- $obj_disabled = ' disabled="disabled"';
219
- else
220
- $obj_disabled = "";
221
-
222
- break;
223
-
224
- case "radio":
225
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'"> '.$label.'</label>';
226
- $obj_name = ' name="'.$input_name.'"';
227
  $obj_type = ' type="'.$type.'"';
228
- $obj_value = ' value="'.$field_id.'"';
229
- $obj_value2 = "";
230
- $obj_tag = "input";
231
- $obj_closing_tag = false;
232
- $obj_style = ' style="width:auto; border:0; background:white;"';
233
-
234
- if (($rules['edit'] == 'no_edit')
235
- || ((($rules['edit'] == 'edit_only_by_admin') || ($rules['edit'] == 'edit_only_by_admin_or_if_empty')) && (!current_user_can('edit_users'))))
236
- $obj_disabled = ' disabled="disabled"';
237
- else
238
- $obj_disabled = "";
239
-
240
- if ($value == "")
241
- $obj_checked = '';
242
- else
243
- $obj_checked.= ' checked="checked"';
244
-
245
- break;
246
 
247
- case "avatar":
248
- case "picture":
249
- // javascript will be added later
250
- $upload_image_function = true;
251
- $obj_label = '<label for="'.$fields_name_prefix.$field_id.'">'.$label.'</label>';
252
- $obj_class = '';
253
- $obj_name = ' name="'.$input_name.'"';
254
- $obj_type = ' type="file"';
255
- $obj_value = ' value=""';
256
- $obj_value2 = '';
257
- $obj_checked = "";
258
- $obj_tag = "input";
259
- $obj_closing_tag = false;
260
- $obj_style = ' onchange="uploadPic(\'your-profile\', \''.$fields_name_prefix.$field_id.'\', \''.__("Please upload an image with one of the following extensions", $cimy_uef_domain).'\');"';
261
-
262
- if ((($old_value != "") && ($rules['edit'] == 'edit_only_if_empty'))
263
- || (($old_value != "") && (!current_user_can('edit_users')) && ($rules['edit'] == 'edit_only_by_admin_or_if_empty'))
264
- || (($rules['edit'] == 'no_edit'))
265
- || (($rules['edit'] == 'edit_only_by_admin') && (!current_user_can('edit_users'))))
266
- $obj_disabled = ' disabled="disabled"';
267
- else
268
- $obj_disabled = "";
269
-
270
- break;
271
 
272
- case "registration-date":
273
- if (isset($rules['equal_to']))
274
- $obj_value = cimy_get_formatted_date($value, $rules['equal_to']);
275
- else
276
- $obj_value = cimy_get_formatted_date($value);
277
 
278
- $obj_label = '<label>'.$label.'</label>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
- break;
281
- }
282
-
283
-
284
- $obj_id = ' id="'.$fields_name_prefix.$field_id.'"';
285
- $obj_class = '';
286
-
287
- $obj_maxlen = "";
288
-
289
- if ((in_array($type, $rule_maxlen_needed)) && (!in_array($type, $cimy_uef_file_types))) {
290
- if (isset($rules['max_length'])) {
291
- $obj_maxlen = ' maxlength="'.$rules['max_length'].'"';
292
- } else if (isset($rules['exact_length'])) {
293
- $obj_maxlen = ' maxlength="'.$rules['exact_length'].'"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
295
- }
296
-
297
- if (in_array($type, $cimy_uef_textarea_types))
298
- $obj_rowscols = ' rows="3" cols="25"';
299
- else
300
- $obj_rowscols = '';
301
-
302
- echo "\t";
303
-
304
- $form_object = '<'.$obj_tag.$obj_id.$obj_class.$obj_name.$obj_type.$obj_value.$obj_checked.$obj_maxlen.$obj_rowscols.$obj_style.$obj_disabled;
 
305
 
306
- if ($obj_closing_tag)
307
- $form_object.= ">".$obj_value2."</".$obj_tag.">";
308
- else
309
- $form_object.= " />";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
 
311
- echo "<th>";
312
- echo $obj_label;
313
- echo "</th>\n";
314
-
315
- echo "\t\t<td>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
 
317
- if (($description != "") && (($type == "picture") || ($type == "picture-url")))
318
- echo $description."<br />";
319
 
320
- if (($type == "avatar") || ($type == "picture")) {
321
- $profileuser = get_user_to_edit($get_user_id);
322
- }
323
 
324
- if ($type == "avatar") {
325
- $user_email = $profileuser->user_email;
326
- echo '<div id="profpic">'.get_avatar($user_email, $size = '128')."</div>\n\t\t";
 
 
 
 
 
 
 
 
327
  }
 
 
 
 
 
 
328
 
329
- if ((($type == "picture") || ($type == "avatar")) && ($value != "")) {
330
- $user_login = $profileuser->user_login;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
 
332
- if ($type == "picture") {
333
- $value_thumb = cimy_get_thumb_path($value);
334
- $file_thumb = $cuef_upload_path.$user_login."/".cimy_get_thumb_path(basename($value));
335
-
336
  echo "\n\t\t";
337
-
338
- if (is_file($file_thumb)) {
339
- echo '<a href="'.$value.'"><img src="'.$value_thumb.'" alt="picture" /></a><br />';
340
- echo "\n\t\t";
341
- }
342
- else {
343
- echo '<img src="'.$value.'" alt="picture" /><br />';
344
- echo "\n\t\t";
345
- }
346
- }
347
-
348
- // if there is no image or there is the default one then disable delete button
349
- if ($old_value == "") {
350
- $dis_delete_img = ' disabled="disabled"';
351
  }
352
- // else if there is an image and it's not the default one
353
- else {
354
- // take the "can be modified" rule just set before
355
- $dis_delete_img = $obj_disabled;
356
-
357
- echo '<input type="hidden" name="'.$input_name.'_oldfile" value="'.basename($value).'" />';
358
  echo "\n\t\t";
359
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
- echo '<input type="checkbox" name="'.$input_name.'_del" value="1" style="width:auto; border:0; background:white;"'.$dis_delete_img.' />';
362
- echo " ".__("Delete the picture", $cimy_uef_domain)."<br /><br />";
363
-
364
- echo "\n\t\t".__("Update the picture", $cimy_uef_domain)."<br />";
365
  echo "\n\t\t";
366
  }
367
 
368
- if ($type == "picture-url") {
369
- if ($value != "") {
370
- if (intval($rules['equal_to'])) {
371
- echo '<a href="'.$value.'">';
372
- echo '<img src="'.$value.'" alt="picture"'.$size.' width="'.intval($rules['equal_to']).'" height="*" />';
373
- echo "</a>";
374
- }
375
- else {
376
- echo '<img src="'.$value.'" alt="picture" />';
377
- }
378
-
379
- echo "<br />";
380
- echo "\n\t\t";
 
 
 
 
 
 
 
 
 
381
  }
382
 
383
- echo "<br />".__("Picture URL:", $cimy_uef_domain)."<br />\n\t\t";
 
384
  }
385
-
386
- // write to the html the form object built
387
- if ($type != "registration-date")
388
- echo $form_object;
389
- else
390
- echo $obj_value;
391
 
392
- if (($description != "") && ($type != "picture") && ($type != "picture-url")) {
393
- if (($type == "textarea") || ($type == "textarea-rich"))
394
- echo "<br />";
395
- else
396
- echo " ";
397
-
398
- echo $description;
399
- }
400
 
401
- echo "</td>";
402
- echo "\n\t</tr>\n";
 
 
 
 
 
 
 
 
 
 
 
403
  }
 
 
 
404
  }
405
 
406
  echo "</table>";
@@ -411,15 +474,15 @@ function cimy_extract_ExtraFields() {
411
  require_once($cuef_plugin_dir.'/cimy_uef_init_mce.php');
412
  }
413
 
414
- if ($upload_image_function)
415
- wp_print_scripts("cimy_uef_upload_pic");
416
 
417
  echo $end_cimy_uef_comment;
418
  }
419
  }
420
 
421
  function cimy_update_ExtraFields() {
422
- global $wpdb, $wpdb_data_table, $user_ID, $max_length_value, $fields_name_prefix;
423
 
424
  // if updating meta-data from registration post then exit
425
  if (isset($_POST['cimy_post']))
@@ -449,113 +512,123 @@ function cimy_update_ExtraFields() {
449
  $label = $thisField["LABEL"];
450
  $rules = $thisField["RULES"];
451
  $input_name = $fields_name_prefix.$wpdb->escape($name);
452
-
453
  cimy_insert_ExtraFields_if_not_exist($get_user_id, $field_id);
454
 
455
- // if flag to view also in the profile is activated
456
- if ($rules['show_in_profile']) {
457
- if ((isset($_POST[$input_name])) && ($type != "picture") && ($type != "avatar")) {
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  $field_value = stripslashes($_POST[$input_name]);
459
-
460
- if ($type == "picture-url")
461
- $field_value = str_replace('../', '', $field_value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
 
463
- if (isset($rules['max_length']))
464
- $field_value = substr($field_value, 0, $rules['max_length']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  else
466
- $field_value = substr($field_value, 0, $max_length_value);
467
-
468
- $field_value = $wpdb->escape($field_value);
469
-
470
- if ($i > 0)
471
- $field_ids.= ", ";
472
  else
473
- $i = 1;
474
-
475
- $field_ids.= $field_id;
476
-
477
- $query.= " WHEN ".$field_id." THEN ";
478
-
479
- switch ($type) {
480
- case 'picture-url':
481
- case 'textarea':
482
- case 'textarea-rich':
483
- case 'dropdown':
484
- case 'password':
485
- case 'text':
486
- $value = "'".$field_value."'";
487
- break;
488
-
489
- case 'checkbox':
490
- $value = $field_value == '1' ? "'YES'" : "'NO'";
491
- break;
492
-
493
- case 'radio':
494
- $value = $field_value == $field_id ? "'selected'" : "''";
495
- break;
496
- }
497
-
498
- $query.= $value;
499
- }
500
- // when a checkbox is not selected then it isn't present in $_POST at all
501
- // file input in html also is not present into $_POST at all so manage here
502
- else {
503
- $rules = $thisField['RULES'];
504
-
505
- if (($type == 'picture') || ($type == "avatar")) {
506
- $profileuser = get_user_to_edit($get_user_id);
507
- $user_login = $profileuser->user_login;
508
-
509
- if ($type == "avatar") {
510
- $is_avatar = true;
511
- // since avatars are drawn max to 512px then we can save bandwith resizing, do it!
512
- $rules['equal_to'] = 512;
513
- }
514
- else
515
- $is_avatar = false;
516
 
517
- if (isset($_POST[$input_name.'_del']))
518
- $delete_file = true;
519
- else
520
- $delete_file = false;
521
-
522
- if (isset($_POST[$input_name.'_oldfile']))
523
- $old_file = stripslashes($_POST[$input_name.'_oldfile']);
524
  else
525
- $old_file = false;