Version Description
Download this release
Release Info
Developer | Cimmo |
Plugin | Cimy User Extra Fields |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- README_OFFICIAL.txt +13 -0
- cimy_uef_admin.php +88 -16
- cimy_uef_email_handler.php +1 -2
- cimy_uef_functions.php +19 -9
- cimy_uef_options.php +10 -6
- cimy_uef_profile.php +2 -2
- cimy_uef_register.php +6 -6
- cimy_user_extra_fields.php +34 -14
- js/ajax_new_value.js +86 -0
- readme.txt +2 -2
README_OFFICIAL.txt
CHANGED
@@ -512,6 +512,12 @@ A: Probably you installed the first time WordPress on PHP4 and you experienced t
|
|
512 |
To fix the problem you need to create another administrator user and change admin user to another role and then back to administrator.
|
513 |
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
Q: I'm using your plug-in on WordPress MultiSite per-blog installation, I'm registering users on one blog but they appear on the main blog too, why?
|
516 |
|
517 |
A: Because WordPress MultiSite is designed like that and I can't do anything about, however all extra fields and relative data are saved per-blog.
|
@@ -563,6 +569,13 @@ A lot of times I cannot reproduce the problem and I need more details, so if you
|
|
563 |
|
564 |
|
565 |
CHANGELOG:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
v2.0.0 - 13/10/2010
|
567 |
- Added possibility to mass-write new data into the Extra Fields from A&U Extended page (thanks to Cuántica Webs for sponsoring it)
|
568 |
- Fixed a debug information leftover introduced in 2.0.0-beta2 when saving a profile (thanks to Erik)
|
512 |
To fix the problem you need to create another administrator user and change admin user to another role and then back to administrator.
|
513 |
|
514 |
|
515 |
+
Q: I'm using your plug-in on WordPress MultiSite per-blog installation and when I register one user all Extra Fields are ignored, why?
|
516 |
+
Q: I get this error: 'Fatal error: Call to undefined function cimy_uef_mu_blog_exists()', why?
|
517 |
+
|
518 |
+
A: Because you missed to move cimy_uef_mu_activation.php file please check carefully the installation steps.
|
519 |
+
|
520 |
+
|
521 |
Q: I'm using your plug-in on WordPress MultiSite per-blog installation, I'm registering users on one blog but they appear on the main blog too, why?
|
522 |
|
523 |
A: Because WordPress MultiSite is designed like that and I can't do anything about, however all extra fields and relative data are saved per-blog.
|
569 |
|
570 |
|
571 |
CHANGELOG:
|
572 |
+
v2.0.1 - 19/11/2010
|
573 |
+
- Added possibility to change individual values "on the fly" into the Extra Fields from A&U Extended page (thanks to Cuántica Webs for sponsoring it)
|
574 |
+
- Added Extra Fields group filtering in the A&U Extended page
|
575 |
+
- Fixed various security issues (thanks to Mark Jaquith)
|
576 |
+
- Fixed all URLs were not caring about https when used (thanks to Álvaro Degives-Más)
|
577 |
+
- Fixed Extra Fields were not included in the admin email even if specified (MS only) (thanks to Kris LaGreca)
|
578 |
+
|
579 |
v2.0.0 - 13/10/2010
|
580 |
- Added possibility to mass-write new data into the Extra Fields from A&U Extended page (thanks to Cuántica Webs for sponsoring it)
|
581 |
- Fixed a debug information leftover introduced in 2.0.0-beta2 when saving a profile (thanks to Erik)
|
cimy_uef_admin.php
CHANGED
@@ -44,22 +44,32 @@ function cimy_admin_define_extra_fields() {
|
|
44 |
$res = cimy_save_options();
|
45 |
}
|
46 |
else if ((isset($_POST["submit_add"])) && (!empty($_POST["submit_add"]))) {
|
|
|
|
|
47 |
$action = "add";
|
48 |
$submit = $_POST["submit_add"];
|
49 |
}
|
50 |
else if ((isset($_POST["submit_edit"])) && (!empty($_POST["submit_edit"]))) {
|
|
|
|
|
51 |
$action = "edit";
|
52 |
$submit = $_POST["submit_edit"];
|
53 |
}
|
54 |
else if ((isset($_POST["submit_del"])) && (!empty($_POST["submit_del"]))) {
|
|
|
|
|
55 |
$action = "del";
|
56 |
$submit = $_POST["submit_del"];
|
57 |
}
|
58 |
else if ((isset($_POST["submit_del_sel"])) && (!empty($_POST["submit_del_sel"]))) {
|
|
|
|
|
59 |
$action = "delSel";
|
60 |
$submit = $_POST["submit_del_sel"];
|
61 |
}
|
62 |
else if ((isset($_POST["submit_order"])) && (!empty($_POST["submit_order"]))) {
|
|
|
|
|
63 |
$action = "order";
|
64 |
$submit = $_POST["submit_order"];
|
65 |
}
|
@@ -614,6 +624,7 @@ function cimy_admin_define_extra_fields() {
|
|
614 |
?>
|
615 |
|
616 |
<form method="post" action="#addfield">
|
|
|
617 |
<p><?php _e("To add a new field you have to choose a name, type and label; optional are value and description. Rules are applied during user registration.", $cimy_uef_domain); ?></p>
|
618 |
<ul>
|
619 |
<li><?php _e("With <strong>radio</strong> and <strong>checkbox</strong>: <em>Value</em> and <em>equal TO</em> can only be 'Yes' or 'No' that means 'selected' or 'not selected'", $cimy_uef_domain); ?></li>
|
@@ -799,7 +810,7 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
|
|
799 |
<form method="post" action="#addfield" id="<?php echo $form_id; ?>">
|
800 |
|
801 |
<?php
|
802 |
-
|
803 |
if ($wp_fields)
|
804 |
echo '<input type="hidden" name="wp_fields" value="1" />';
|
805 |
|
@@ -1197,6 +1208,8 @@ function cimy_admin_show_extra_fields($allFields, $submit_msgs, $wp_fields, $err
|
|
1197 |
}
|
1198 |
|
1199 |
function cimy_uef_print_messages($errors, $results) {
|
|
|
|
|
1200 |
if (count($errors) > 0) {
|
1201 |
?>
|
1202 |
<div class="error inline">
|
@@ -1231,7 +1244,7 @@ function cimy_uef_print_messages($errors, $results) {
|
|
1231 |
}
|
1232 |
|
1233 |
function cimy_admin_users_list_page() {
|
1234 |
-
global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain;
|
1235 |
|
1236 |
if (!cimy_check_admin('edit_users'))
|
1237 |
return;
|
@@ -1251,7 +1264,9 @@ function cimy_admin_users_list_page() {
|
|
1251 |
|
1252 |
$extra_fields = get_cimyFields();
|
1253 |
|
1254 |
-
if (isset($_POST["submit_new_values"])) {
|
|
|
|
|
1255 |
foreach ($_POST["users"] as $user_id) {
|
1256 |
foreach ($_POST["ef_write_type"] as $ef_name=>$ef_type) {
|
1257 |
if (!isset($_POST["ef_write_sel"][$ef_name]))
|
@@ -1275,6 +1290,12 @@ function cimy_admin_users_list_page() {
|
|
1275 |
}
|
1276 |
}
|
1277 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1278 |
// yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it!
|
1279 |
class Cimy_User_Search extends WP_User_Search {
|
1280 |
function Cimy_User_Search ($search_term = '', $page = '', $role = '', $users_per_page = 50) {
|
@@ -1299,7 +1320,6 @@ function cimy_admin_users_list_page() {
|
|
1299 |
|
1300 |
// Query the users
|
1301 |
$wp_user_search = new Cimy_User_Search($_POST['usersearch'], $_GET['userspage'], $_GET['role'], $users_per_page);
|
1302 |
-
|
1303 |
$search_result = $wp_user_search->get_results();
|
1304 |
|
1305 |
// search into extra field engine
|
@@ -1319,7 +1339,6 @@ function cimy_admin_users_list_page() {
|
|
1319 |
|
1320 |
if ($ef_search != "") {
|
1321 |
$remove = false;
|
1322 |
-
|
1323 |
$ef_value = $wpdb->get_var("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$userid." AND FIELD_ID=".$ef_id);
|
1324 |
|
1325 |
if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url") || ($ef_type == "file")) {
|
@@ -1386,6 +1405,7 @@ function cimy_admin_users_list_page() {
|
|
1386 |
<form id="posts-filter" action="" method="post">
|
1387 |
<ul class="subsubsub">
|
1388 |
<?php
|
|
|
1389 |
$role_links = array();
|
1390 |
$avail_roles = array();
|
1391 |
$users_of_blog = get_users_of_blog();
|
@@ -1459,10 +1479,14 @@ function cimy_admin_users_list_page() {
|
|
1459 |
<?php if ( $wp_user_search->is_search() ) : ?>
|
1460 |
<p><a href="users.php?page=au_extended"><?php _e('« Back to All Users'); ?></a></p>
|
1461 |
<?php endif;
|
1462 |
-
|
1463 |
wp_print_scripts('admin-forms');
|
1464 |
?>
|
1465 |
<div class="alignleft actions">
|
|
|
|
|
|
|
|
|
1466 |
<?php _e("Users per page", $cimy_uef_domain); ?>
|
1467 |
<select name="cimy_uef_users_per_page">
|
1468 |
<?php
|
@@ -1535,10 +1559,14 @@ function cimy_admin_users_list_page() {
|
|
1535 |
$id = $thisField['ID'];
|
1536 |
$name = $thisField['NAME'];
|
1537 |
$type = $thisField['TYPE'];
|
|
|
1538 |
|
1539 |
if ($type == "avatar")
|
1540 |
continue;
|
1541 |
-
|
|
|
|
|
|
|
1542 |
$search_input = "";
|
1543 |
$search_value = "";
|
1544 |
|
@@ -1559,7 +1587,7 @@ function cimy_admin_users_list_page() {
|
|
1559 |
$label = $ret['label'];
|
1560 |
|
1561 |
$search_input = '<select name="ef_search['.$name.']"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
|
1562 |
-
$write_input[$i] = '<td>'.$label.'</td><td><select name="ef_write['.$name.']"><option>'.$dropdown_first_item.'</option>'.$ret2.'</select>';
|
1563 |
break;
|
1564 |
case "dropdown-multi":
|
1565 |
$ret = cimy_dropDownOptions($label, $search_value);
|
@@ -1567,14 +1595,14 @@ function cimy_admin_users_list_page() {
|
|
1567 |
$label = $ret['label'];
|
1568 |
|
1569 |
$search_input = '<select name="ef_search['.$name.'][]" multiple="multiple" style="height: 6em;"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
|
1570 |
-
$write_input[$i] = '<td>'.$label.'</td><td><select name="ef_write['.$name.'][]" multiple="multiple" style="height: 6em;"><option>'.$dropdown_first_item.'</option>'.$ret2.'</select>';
|
1571 |
break;
|
1572 |
case "text":
|
1573 |
case "textarea":
|
1574 |
case "textarea-rich":
|
1575 |
case "picture-url":
|
1576 |
$search_input = '<input type="text" name="ef_search['.$name.']" value="'.$search_value.'" size="6" />';
|
1577 |
-
$write_input[$i] = '<td>'.$label.'</td><td><input type="text" name="ef_write['.$name.']" value="" size="40" />';
|
1578 |
break;
|
1579 |
case "picture":
|
1580 |
case "file":
|
@@ -1587,7 +1615,7 @@ function cimy_admin_users_list_page() {
|
|
1587 |
$checkbox_selected = "";
|
1588 |
|
1589 |
$search_input = '<input type="checkbox" name="ef_search['.$name.']" value="1"'.$checkbox_selected.' />';
|
1590 |
-
$write_input[$i] = '<td>'.$label.'</td><td><input type="checkbox" name="ef_write['.$name.']" value="1" />';
|
1591 |
break;
|
1592 |
|
1593 |
case "radio":
|
@@ -1702,7 +1730,6 @@ function cimy_admin_users_list_page() {
|
|
1702 |
// print all the content of extra fields if there are some
|
1703 |
if (count($extra_fields) > 0) {
|
1704 |
foreach ($extra_fields as $thisField) {
|
1705 |
-
|
1706 |
$field_id = $thisField['ID'];
|
1707 |
|
1708 |
// if user has not yet fields in the data table then create them
|
@@ -1713,14 +1740,18 @@ function cimy_admin_users_list_page() {
|
|
1713 |
$ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$user_object->ID, ARRAY_A);
|
1714 |
|
1715 |
foreach ($extra_fields as $thisField) {
|
1716 |
-
|
1717 |
$rules = $thisField['RULES'];
|
1718 |
$type = $thisField['TYPE'];
|
1719 |
$value = $thisField['VALUE'];
|
|
|
1720 |
|
1721 |
if ($type == "avatar")
|
1722 |
continue;
|
1723 |
|
|
|
|
|
|
|
1724 |
if ($rules['show_in_aeu']) {
|
1725 |
$field_id = $thisField['ID'];
|
1726 |
|
@@ -1732,7 +1763,9 @@ function cimy_admin_users_list_page() {
|
|
1732 |
}
|
1733 |
|
1734 |
echo "<td>";
|
1735 |
-
|
|
|
|
|
1736 |
if ($type == "picture-url") {
|
1737 |
if ($field == "")
|
1738 |
$field = $value;
|
@@ -1792,8 +1825,12 @@ function cimy_admin_users_list_page() {
|
|
1792 |
}
|
1793 |
else
|
1794 |
echo $field;
|
1795 |
-
|
1796 |
-
echo "
|
|
|
|
|
|
|
|
|
1797 |
}
|
1798 |
}
|
1799 |
}
|
@@ -1847,6 +1884,41 @@ function cimy_admin_users_list_page() {
|
|
1847 |
<?php
|
1848 |
}
|
1849 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1850 |
function cimy_save_field($action, $table, $data) {
|
1851 |
global $wpdb, $wpdb_wp_fields_table;
|
1852 |
|
44 |
$res = cimy_save_options();
|
45 |
}
|
46 |
else if ((isset($_POST["submit_add"])) && (!empty($_POST["submit_add"]))) {
|
47 |
+
if (!check_admin_referer('cimy_uef_addfield', 'cimy_uef_addfieldnonce'))
|
48 |
+
return;
|
49 |
$action = "add";
|
50 |
$submit = $_POST["submit_add"];
|
51 |
}
|
52 |
else if ((isset($_POST["submit_edit"])) && (!empty($_POST["submit_edit"]))) {
|
53 |
+
if (!check_admin_referer('cimy_uef_editfield', 'cimy_uef_editfieldnonce'))
|
54 |
+
return;
|
55 |
$action = "edit";
|
56 |
$submit = $_POST["submit_edit"];
|
57 |
}
|
58 |
else if ((isset($_POST["submit_del"])) && (!empty($_POST["submit_del"]))) {
|
59 |
+
if (!check_admin_referer('cimy_uef_editfield', 'cimy_uef_editfieldnonce'))
|
60 |
+
return;
|
61 |
$action = "del";
|
62 |
$submit = $_POST["submit_del"];
|
63 |
}
|
64 |
else if ((isset($_POST["submit_del_sel"])) && (!empty($_POST["submit_del_sel"]))) {
|
65 |
+
if (!check_admin_referer('cimy_uef_editfield', 'cimy_uef_editfieldnonce'))
|
66 |
+
return;
|
67 |
$action = "delSel";
|
68 |
$submit = $_POST["submit_del_sel"];
|
69 |
}
|
70 |
else if ((isset($_POST["submit_order"])) && (!empty($_POST["submit_order"]))) {
|
71 |
+
if (!check_admin_referer('cimy_uef_editfield', 'cimy_uef_editfieldnonce'))
|
72 |
+
return;
|
73 |
$action = "order";
|
74 |
$submit = $_POST["submit_order"];
|
75 |
}
|
624 |
?>
|
625 |
|
626 |
<form method="post" action="#addfield">
|
627 |
+
<?php wp_nonce_field('cimy_uef_addfield', 'cimy_uef_addfieldnonce', false); ?>
|
628 |
<p><?php _e("To add a new field you have to choose a name, type and label; optional are value and description. Rules are applied during user registration.", $cimy_uef_domain); ?></p>
|
629 |
<ul>
|
630 |
<li><?php _e("With <strong>radio</strong> and <strong>checkbox</strong>: <em>Value</em> and <em>equal TO</em> can only be 'Yes' or 'No' that means 'selected' or 'not selected'", $cimy_uef_domain); ?></li>
|
810 |
<form method="post" action="#addfield" id="<?php echo $form_id; ?>">
|
811 |
|
812 |
<?php
|
813 |
+
wp_nonce_field('cimy_uef_editfield', 'cimy_uef_editfieldnonce', false);
|
814 |
if ($wp_fields)
|
815 |
echo '<input type="hidden" name="wp_fields" value="1" />';
|
816 |
|
1208 |
}
|
1209 |
|
1210 |
function cimy_uef_print_messages($errors, $results) {
|
1211 |
+
global $cimy_uef_domain;
|
1212 |
+
|
1213 |
if (count($errors) > 0) {
|
1214 |
?>
|
1215 |
<div class="error inline">
|
1244 |
}
|
1245 |
|
1246 |
function cimy_admin_users_list_page() {
|
1247 |
+
global $wpdb, $wp_roles, $wpdb_data_table, $cimy_uef_options, $cuef_upload_path, $cimy_uef_domain, $cimy_uef_file_types;
|
1248 |
|
1249 |
if (!cimy_check_admin('edit_users'))
|
1250 |
return;
|
1264 |
|
1265 |
$extra_fields = get_cimyFields();
|
1266 |
|
1267 |
+
if ((isset($_POST["submit_new_values"])) && (!empty($_POST["users"])) && (!empty($_POST["ef_write_type"]))) {
|
1268 |
+
if (!check_admin_referer('extrafieldnewvalue', 'extrafieldnewvaluenonce'))
|
1269 |
+
return;
|
1270 |
foreach ($_POST["users"] as $user_id) {
|
1271 |
foreach ($_POST["ef_write_type"] as $ef_name=>$ef_type) {
|
1272 |
if (!isset($_POST["ef_write_sel"][$ef_name]))
|
1290 |
}
|
1291 |
}
|
1292 |
}
|
1293 |
+
|
1294 |
+
if (isset($_POST["fieldset"][0]))
|
1295 |
+
$fieldset_selection = $_POST["fieldset"][0];
|
1296 |
+
else
|
1297 |
+
$fieldset_selection = -1;
|
1298 |
+
|
1299 |
// yes stupid WP_User_Search doesn't support custom $users_per_page support, lets add it!
|
1300 |
class Cimy_User_Search extends WP_User_Search {
|
1301 |
function Cimy_User_Search ($search_term = '', $page = '', $role = '', $users_per_page = 50) {
|
1320 |
|
1321 |
// Query the users
|
1322 |
$wp_user_search = new Cimy_User_Search($_POST['usersearch'], $_GET['userspage'], $_GET['role'], $users_per_page);
|
|
|
1323 |
$search_result = $wp_user_search->get_results();
|
1324 |
|
1325 |
// search into extra field engine
|
1339 |
|
1340 |
if ($ef_search != "") {
|
1341 |
$remove = false;
|
|
|
1342 |
$ef_value = $wpdb->get_var("SELECT VALUE FROM ".$wpdb_data_table." WHERE USER_ID=".$userid." AND FIELD_ID=".$ef_id);
|
1343 |
|
1344 |
if (($ef_type == "text") || ($ef_type == "textarea") || ($ef_type == "textarea-rich") || ($ef_type == "picture") || ($ef_type == "picture-url") || ($ef_type == "file")) {
|
1405 |
<form id="posts-filter" action="" method="post">
|
1406 |
<ul class="subsubsub">
|
1407 |
<?php
|
1408 |
+
wp_nonce_field('extrafieldnewvalue', 'extrafieldnewvaluenonce', false);
|
1409 |
$role_links = array();
|
1410 |
$avail_roles = array();
|
1411 |
$users_of_blog = get_users_of_blog();
|
1479 |
<?php if ( $wp_user_search->is_search() ) : ?>
|
1480 |
<p><a href="users.php?page=au_extended"><?php _e('« Back to All Users'); ?></a></p>
|
1481 |
<?php endif;
|
1482 |
+
|
1483 |
wp_print_scripts('admin-forms');
|
1484 |
?>
|
1485 |
<div class="alignleft actions">
|
1486 |
+
<label><?php _e("Fieldset", $cimy_uef_domain); ?>
|
1487 |
+
<?php echo cimy_fieldsetOptions($fieldset_selection, 0, true); ?>
|
1488 |
+
</label>
|
1489 |
+
|
1490 |
<?php _e("Users per page", $cimy_uef_domain); ?>
|
1491 |
<select name="cimy_uef_users_per_page">
|
1492 |
<?php
|
1559 |
$id = $thisField['ID'];
|
1560 |
$name = $thisField['NAME'];
|
1561 |
$type = $thisField['TYPE'];
|
1562 |
+
$fieldset = $thisField["FIELDSET"];
|
1563 |
|
1564 |
if ($type == "avatar")
|
1565 |
continue;
|
1566 |
+
|
1567 |
+
if (($fieldset_selection > -1) && ($fieldset_selection != $fieldset))
|
1568 |
+
continue;
|
1569 |
+
|
1570 |
$search_input = "";
|
1571 |
$search_value = "";
|
1572 |
|
1587 |
$label = $ret['label'];
|
1588 |
|
1589 |
$search_input = '<select name="ef_search['.$name.']"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
|
1590 |
+
$write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name.'"><select name="ef_write['.$name.']"><option>'.$dropdown_first_item.'</option>'.$ret2.'</select>';
|
1591 |
break;
|
1592 |
case "dropdown-multi":
|
1593 |
$ret = cimy_dropDownOptions($label, $search_value);
|
1595 |
$label = $ret['label'];
|
1596 |
|
1597 |
$search_input = '<select name="ef_search['.$name.'][]" multiple="multiple" style="height: 6em;"><option>'.$dropdown_first_item.'</option>'.$ret['html'].'</select>';
|
1598 |
+
$write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name.'"><select name="ef_write['.$name.'][]" multiple="multiple" style="height: 6em;"><option>'.$dropdown_first_item.'</option>'.$ret2.'</select>';
|
1599 |
break;
|
1600 |
case "text":
|
1601 |
case "textarea":
|
1602 |
case "textarea-rich":
|
1603 |
case "picture-url":
|
1604 |
$search_input = '<input type="text" name="ef_search['.$name.']" value="'.$search_value.'" size="6" />';
|
1605 |
+
$write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name.'"><input type="text" name="ef_write['.$name.']" value="" size="40" />';
|
1606 |
break;
|
1607 |
case "picture":
|
1608 |
case "file":
|
1615 |
$checkbox_selected = "";
|
1616 |
|
1617 |
$search_input = '<input type="checkbox" name="ef_search['.$name.']" value="1"'.$checkbox_selected.' />';
|
1618 |
+
$write_input[$i] = '<td>'.$label.'</td><td id="ef-new-value-'.$name.'"><input type="checkbox" name="ef_write['.$name.']" value="1" />';
|
1619 |
break;
|
1620 |
|
1621 |
case "radio":
|
1730 |
// print all the content of extra fields if there are some
|
1731 |
if (count($extra_fields) > 0) {
|
1732 |
foreach ($extra_fields as $thisField) {
|
|
|
1733 |
$field_id = $thisField['ID'];
|
1734 |
|
1735 |
// if user has not yet fields in the data table then create them
|
1740 |
$ef_db = $wpdb->get_results("SELECT FIELD_ID, VALUE FROM ".$wpdb_data_table." WHERE USER_ID = ".$user_object->ID, ARRAY_A);
|
1741 |
|
1742 |
foreach ($extra_fields as $thisField) {
|
1743 |
+
$name = $thisField['NAME'];
|
1744 |
$rules = $thisField['RULES'];
|
1745 |
$type = $thisField['TYPE'];
|
1746 |
$value = $thisField['VALUE'];
|
1747 |
+
$fieldset = $thisField["FIELDSET"];
|
1748 |
|
1749 |
if ($type == "avatar")
|
1750 |
continue;
|
1751 |
|
1752 |
+
if (($fieldset_selection > -1) && ($fieldset_selection != $fieldset))
|
1753 |
+
continue;
|
1754 |
+
|
1755 |
if ($rules['show_in_aeu']) {
|
1756 |
$field_id = $thisField['ID'];
|
1757 |
|
1763 |
}
|
1764 |
|
1765 |
echo "<td>";
|
1766 |
+
echo "<span id=\"edit-".$user_object->ID."-".$name."\">";
|
1767 |
+
echo "<div id=\"value-".$user_object->ID."-".$name."\">";
|
1768 |
+
|
1769 |
if ($type == "picture-url") {
|
1770 |
if ($field == "")
|
1771 |
$field = $value;
|
1825 |
}
|
1826 |
else
|
1827 |
echo $field;
|
1828 |
+
|
1829 |
+
echo "</div>";
|
1830 |
+
if ((!in_array($type, $cimy_uef_file_types)) && ($type != "radio"))
|
1831 |
+
echo "[<a href=\"#\" onclick=\"editExtraField(".$user_object->ID.", '".$name."'); return false;\">".__("Change")."</a>]";
|
1832 |
+
|
1833 |
+
echo " </span></td>";
|
1834 |
}
|
1835 |
}
|
1836 |
}
|
1884 |
<?php
|
1885 |
}
|
1886 |
|
1887 |
+
function cimy_uef_admin_ajax_edit() {
|
1888 |
+
global $cimy_uef_domain;
|
1889 |
+
|
1890 |
+
$dropdown_first_item = '--- '.__("select", $cimy_uef_domain).' ---';
|
1891 |
+
?>
|
1892 |
+
<script type='text/javascript'>
|
1893 |
+
/* <![CDATA[ */
|
1894 |
+
var postL10n = {
|
1895 |
+
ok: "<?php echo esc_js(__('OK')); ?>",
|
1896 |
+
cancel: "<?php echo esc_js( __('Cancel')); ?>",
|
1897 |
+
dropdown_first_item: "<?php echo esc_js($dropdown_first_item); ?>"
|
1898 |
+
};
|
1899 |
+
try{convertEntities(postL10n);}catch(e){};
|
1900 |
+
/* ]]> */
|
1901 |
+
</script>
|
1902 |
+
<?php
|
1903 |
+
wp_enqueue_script("cimy_uef_ajax_new_value");
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
function cimy_uef_admin_ajax_save_ef_new_value() {
|
1907 |
+
check_ajax_referer('extrafieldnewvalue', 'extrafieldnewvaluenonce');
|
1908 |
+
$user_id = $_POST["user_id"];
|
1909 |
+
$field_name = $_POST["field_name"];
|
1910 |
+
$new_value = $_POST["new_value"];
|
1911 |
+
|
1912 |
+
$res = set_cimyFieldValue($user_id, $field_name, $new_value);
|
1913 |
+
|
1914 |
+
if (!empty($res[0]["USER_ID"]))
|
1915 |
+
echo esc_attr($new_value);
|
1916 |
+
else
|
1917 |
+
echo null;
|
1918 |
+
|
1919 |
+
die;
|
1920 |
+
}
|
1921 |
+
|
1922 |
function cimy_save_field($action, $table, $data) {
|
1923 |
global $wpdb, $wpdb_wp_fields_table;
|
1924 |
|
cimy_uef_email_handler.php
CHANGED
@@ -11,9 +11,8 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
|
|
11 |
if (isset($_POST["cimy_uef_wp_PASSWORD"]))
|
12 |
delete_usermeta($user_id, 'default_password_nag');
|
13 |
|
|
|
14 |
if (!is_multisite()) {
|
15 |
-
$options = cimy_get_options();
|
16 |
-
|
17 |
if (!$options["confirm_email"])
|
18 |
wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"]);
|
19 |
// if confirmation email is enabled delete the default_password_nag but checks first if has not been done on top of this function!
|
11 |
if (isset($_POST["cimy_uef_wp_PASSWORD"]))
|
12 |
delete_usermeta($user_id, 'default_password_nag');
|
13 |
|
14 |
+
$options = cimy_get_options();
|
15 |
if (!is_multisite()) {
|
|
|
|
|
16 |
if (!$options["confirm_email"])
|
17 |
wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"]);
|
18 |
// if confirmation email is enabled delete the default_password_nag but checks first if has not been done on top of this function!
|
cimy_uef_functions.php
CHANGED
@@ -403,7 +403,7 @@ function cimy_check_admin($permission) {
|
|
403 |
return false;
|
404 |
}
|
405 |
|
406 |
-
function cimy_fieldsetOptions($selected=0, $order="") {
|
407 |
global $cimy_uef_domain;
|
408 |
|
409 |
if (!cimy_check_admin('manage_options'))
|
@@ -414,20 +414,30 @@ function cimy_fieldsetOptions($selected=0, $order="") {
|
|
414 |
$i = 0;
|
415 |
$html = "<select name=\"fieldset[".$order."]\">\n";
|
416 |
|
417 |
-
if ($options['fieldset_title']
|
418 |
$html.= "\t<option value=\"$i\" selected=\"selected\">".__("no fieldset", $cimy_uef_domain)."</option>\n";
|
419 |
}
|
420 |
else {
|
421 |
-
|
422 |
-
|
423 |
-
foreach ($fieldset_titles as $fieldset) {
|
424 |
-
if ($i == $selected)
|
425 |
$selected_txt = " selected=\"selected\"";
|
426 |
else
|
427 |
$selected_txt = "";
|
428 |
-
|
429 |
-
|
430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
}
|
432 |
}
|
433 |
|
403 |
return false;
|
404 |
}
|
405 |
|
406 |
+
function cimy_fieldsetOptions($selected=0, $order="", $select_all=false) {
|
407 |
global $cimy_uef_domain;
|
408 |
|
409 |
if (!cimy_check_admin('manage_options'))
|
414 |
$i = 0;
|
415 |
$html = "<select name=\"fieldset[".$order."]\">\n";
|
416 |
|
417 |
+
if (empty($options['fieldset_title']) && !$select_all) {
|
418 |
$html.= "\t<option value=\"$i\" selected=\"selected\">".__("no fieldset", $cimy_uef_domain)."</option>\n";
|
419 |
}
|
420 |
else {
|
421 |
+
if ($select_all) {
|
422 |
+
if (-1 == $selected)
|
|
|
|
|
423 |
$selected_txt = " selected=\"selected\"";
|
424 |
else
|
425 |
$selected_txt = "";
|
426 |
+
$html.= "\t<option value=\"-1\"".$selected_txt.">".__("All")."</option>\n";
|
427 |
+
}
|
428 |
+
|
429 |
+
if (!empty($options['fieldset_title'])) {
|
430 |
+
$fieldset_titles = explode(',', $options['fieldset_title']);
|
431 |
+
|
432 |
+
foreach ($fieldset_titles as $fieldset) {
|
433 |
+
if ($i == $selected)
|
434 |
+
$selected_txt = " selected=\"selected\"";
|
435 |
+
else
|
436 |
+
$selected_txt = "";
|
437 |
+
|
438 |
+
$html.= "\t<option value=\"$i\"".$selected_txt.">".$fieldset."</option>\n";
|
439 |
+
$i++;
|
440 |
+
}
|
441 |
}
|
442 |
}
|
443 |
|
cimy_uef_options.php
CHANGED
@@ -10,7 +10,10 @@ function cimy_save_options() {
|
|
10 |
cimy_plugin_install();
|
11 |
return;
|
12 |
}
|
13 |
-
|
|
|
|
|
|
|
14 |
$results = array();
|
15 |
$do_not_save_options = false;
|
16 |
|
@@ -517,6 +520,7 @@ function cimy_show_options($results, $embedded) {
|
|
517 |
}
|
518 |
|
519 |
?><form method="post" action="#options" id="cimy_uef_options">
|
|
|
520 |
<p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /></p>
|
521 |
<h3><?php _e("General"); ?></h3>
|
522 |
<table class="form-table">
|
@@ -608,11 +612,11 @@ function cimy_show_options($results, $embedded) {
|
|
608 |
<?php
|
609 |
_e("Public KEY", $cimy_uef_domain);
|
610 |
?>
|
611 |
-
<input type="text" name="recaptcha_public_key" value="<?php echo $recaptcha_public_key; ?>" size="40" /><br />
|
612 |
<?php
|
613 |
_e("Private KEY", $cimy_uef_domain);
|
614 |
?>
|
615 |
-
<input type="text" name="recaptcha_private_key" value="<?php echo $recaptcha_private_key; ?>" size="40" />
|
616 |
</td>
|
617 |
</tr>
|
618 |
<tr>
|
@@ -635,7 +639,7 @@ function cimy_show_options($results, $embedded) {
|
|
635 |
<th scope="row"><?php _e("Change login/registration page logo", $cimy_uef_domain); ?></th>
|
636 |
<td>
|
637 |
<?php if (!empty($options["registration-logo"])) { ?><input type="hidden" name="registration_logo_oldfile" value="<?php echo basename($options["registration-logo"]); ?>" />
|
638 |
-
<?php echo basename($options["registration-logo"]).'<br />'; ?>
|
639 |
<input type="checkbox" name="registration_logo_del" value="1" />
|
640 |
<?php echo " ".__("Delete the picture", $cimy_uef_domain); ?><br /><br /><?php } ?>
|
641 |
|
@@ -734,11 +738,11 @@ function cimy_show_options($results, $embedded) {
|
|
734 |
<table class="form-table">
|
735 |
<tr>
|
736 |
<th scope="row" width="40%"><?php _e("Extra Fields section title", $cimy_uef_domain); ?></th>
|
737 |
-
<td width="60%"><input type="text" name="extra_fields_title" value="<?php echo $options['extra_fields_title']; ?>" size="35" maxlength="<?php echo $max_length_extra_fields_title; ?>" /></td>
|
738 |
</tr>
|
739 |
<tr>
|
740 |
<th scope="row"><?php _e("Fieldset's titles, separates with comma", $cimy_uef_domain); ?><br /><?php _e("example: title1,title2,title3", $cimy_uef_domain); ?></th>
|
741 |
-
<td><input type="text" name="fieldset_title" value="<?php echo $options['fieldset_title']; ?>" size="35" maxlength="<?php echo $max_length_fieldset_value; ?>" /> <?php _e("<strong>note:</strong> if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again", $cimy_uef_domain); ?></td>
|
742 |
</tr>
|
743 |
|
744 |
</table>
|
10 |
cimy_plugin_install();
|
11 |
return;
|
12 |
}
|
13 |
+
|
14 |
+
if (!check_admin_referer('cimy_uef_options', 'cimy_uef_optionsnonce'))
|
15 |
+
return;
|
16 |
+
|
17 |
$results = array();
|
18 |
$do_not_save_options = false;
|
19 |
|
520 |
}
|
521 |
|
522 |
?><form method="post" action="#options" id="cimy_uef_options">
|
523 |
+
<?php wp_nonce_field('cimy_uef_options', 'cimy_uef_optionsnonce', false); ?>
|
524 |
<p class="submit" style="border-width: 0px;"><input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /></p>
|
525 |
<h3><?php _e("General"); ?></h3>
|
526 |
<table class="form-table">
|
612 |
<?php
|
613 |
_e("Public KEY", $cimy_uef_domain);
|
614 |
?>
|
615 |
+
<input type="text" name="recaptcha_public_key" value="<?php echo esc_attr($recaptcha_public_key); ?>" size="40" /><br />
|
616 |
<?php
|
617 |
_e("Private KEY", $cimy_uef_domain);
|
618 |
?>
|
619 |
+
<input type="text" name="recaptcha_private_key" value="<?php echo esc_attr($recaptcha_private_key); ?>" size="40" />
|
620 |
</td>
|
621 |
</tr>
|
622 |
<tr>
|
639 |
<th scope="row"><?php _e("Change login/registration page logo", $cimy_uef_domain); ?></th>
|
640 |
<td>
|
641 |
<?php if (!empty($options["registration-logo"])) { ?><input type="hidden" name="registration_logo_oldfile" value="<?php echo basename($options["registration-logo"]); ?>" />
|
642 |
+
<?php echo esc_html(basename($options["registration-logo"])).'<br />'; ?>
|
643 |
<input type="checkbox" name="registration_logo_del" value="1" />
|
644 |
<?php echo " ".__("Delete the picture", $cimy_uef_domain); ?><br /><br /><?php } ?>
|
645 |
|
738 |
<table class="form-table">
|
739 |
<tr>
|
740 |
<th scope="row" width="40%"><?php _e("Extra Fields section title", $cimy_uef_domain); ?></th>
|
741 |
+
<td width="60%"><input type="text" name="extra_fields_title" value="<?php echo esc_attr($options['extra_fields_title']); ?>" size="35" maxlength="<?php echo $max_length_extra_fields_title; ?>" /></td>
|
742 |
</tr>
|
743 |
<tr>
|
744 |
<th scope="row"><?php _e("Fieldset's titles, separates with comma", $cimy_uef_domain); ?><br /><?php _e("example: title1,title2,title3", $cimy_uef_domain); ?></th>
|
745 |
+
<td><input type="text" name="fieldset_title" value="<?php echo esc_attr($options['fieldset_title']); ?>" size="35" maxlength="<?php echo $max_length_fieldset_value; ?>" /> <?php _e("<strong>note:</strong> if you change order or remove fieldsets you may need to set all extra fields' fieldset assigment again", $cimy_uef_domain); ?></td>
|
746 |
</tr>
|
747 |
|
748 |
</table>
|
cimy_uef_profile.php
CHANGED
@@ -36,7 +36,7 @@ function cimy_extract_ExtraFields() {
|
|
36 |
|
37 |
if ($options['extra_fields_title'] != "") {
|
38 |
echo "<br clear=\"all\" />\n";
|
39 |
-
echo "<h2>"
|
40 |
}
|
41 |
|
42 |
foreach ($extra_fields as $thisField) {
|
@@ -110,7 +110,7 @@ function cimy_extract_ExtraFields() {
|
|
110 |
$close_table = true;
|
111 |
|
112 |
if (isset($fieldset_titles[$current_fieldset]))
|
113 |
-
echo "\n\t<h3>"
|
114 |
|
115 |
echo '<table class="form-table">';
|
116 |
echo "\n";
|
36 |
|
37 |
if ($options['extra_fields_title'] != "") {
|
38 |
echo "<br clear=\"all\" />\n";
|
39 |
+
echo "<h2>".esc_html($options['extra_fields_title'])."</h2>\n";
|
40 |
}
|
41 |
|
42 |
foreach ($extra_fields as $thisField) {
|
110 |
$close_table = true;
|
111 |
|
112 |
if (isset($fieldset_titles[$current_fieldset]))
|
113 |
+
echo "\n\t<h3>".esc_html($fieldset_titles[$current_fieldset])."</h3>\n";
|
114 |
|
115 |
echo '<table class="form-table">';
|
116 |
echo "\n";
|
cimy_uef_register.php
CHANGED
@@ -308,7 +308,7 @@ function cimy_registration_check($user_login, $user_email, $errors) {
|
|
308 |
$name = $thisField['NAME'];
|
309 |
$rules = $thisField['RULES'];
|
310 |
$type = $thisField['TYPE'];
|
311 |
-
$label = $thisField['LABEL'];
|
312 |
$description = $thisField['DESCRIPTION'];
|
313 |
$input_name = $prefix.$wpdb->escape($name);
|
314 |
$unique_id = $prefix.$field_id;
|
@@ -373,7 +373,7 @@ function cimy_registration_check($user_login, $user_email, $errors) {
|
|
373 |
|
374 |
if ($type == "dropdown") {
|
375 |
$ret = cimy_dropDownOptions($label, $value);
|
376 |
-
$label = $ret['label'];
|
377 |
$html = $ret['html'];
|
378 |
}
|
379 |
|
@@ -693,7 +693,7 @@ function cimy_registration_form($errors=null, $show_type=0) {
|
|
693 |
$current_fieldset = $fieldset;
|
694 |
|
695 |
if (isset($fieldset_titles[$current_fieldset]))
|
696 |
-
echo "\n\t<h2>"
|
697 |
}
|
698 |
|
699 |
if (($description != "") && ($type != "registration-date")) {
|
@@ -942,10 +942,10 @@ function cimy_registration_form($errors=null, $show_type=0) {
|
|
942 |
global $cuef_securimage_webpath;
|
943 |
?>
|
944 |
<div style="width: 278px; float: left; height: 80px; vertical-align: text-top;">
|
945 |
-
<img id="captcha" align="left" style="padding-right: 5px; border: 0" src="<?php echo $cuef_securimage_webpath;
|
946 |
-
<object type="application/x-shockwave-flash" data="<?php echo $cuef_securimage_webpath;
|
947 |
<br /><br /><br /><br />
|
948 |
-
<a align="right" tabindex="<?php echo $tabindex; $tabindex++; ?>" style="border-style: none" href="#" onclick="document.getElementById('captcha').src = '<?php echo $cuef_securimage_webpath;
|
949 |
</div>
|
950 |
<div style="width: 278px; float: left; height: 50px; vertical-align: bottom; padding: 5px;">
|
951 |
<?php _e("Insert the code:", $cimy_uef_domain); ?> <input type="text" name="securimage_response_field" size="10" maxlength="6" tabindex="<?php echo $tabindex; $tabindex++; ?>" />
|
308 |
$name = $thisField['NAME'];
|
309 |
$rules = $thisField['RULES'];
|
310 |
$type = $thisField['TYPE'];
|
311 |
+
$label = esc_html($thisField['LABEL']);
|
312 |
$description = $thisField['DESCRIPTION'];
|
313 |
$input_name = $prefix.$wpdb->escape($name);
|
314 |
$unique_id = $prefix.$field_id;
|
373 |
|
374 |
if ($type == "dropdown") {
|
375 |
$ret = cimy_dropDownOptions($label, $value);
|
376 |
+
$label = esc_html($ret['label']);
|
377 |
$html = $ret['html'];
|
378 |
}
|
379 |
|
693 |
$current_fieldset = $fieldset;
|
694 |
|
695 |
if (isset($fieldset_titles[$current_fieldset]))
|
696 |
+
echo "\n\t<h2>".esc_html($fieldset_titles[$current_fieldset])."</h2>\n";
|
697 |
}
|
698 |
|
699 |
if (($description != "") && ($type != "registration-date")) {
|
942 |
global $cuef_securimage_webpath;
|
943 |
?>
|
944 |
<div style="width: 278px; float: left; height: 80px; vertical-align: text-top;">
|
945 |
+
<img id="captcha" align="left" style="padding-right: 5px; border: 0" src="<?php echo $cuef_securimage_webpath; ?>/securimage_show_captcha.php" alt="CAPTCHA Image" />
|
946 |
+
<object type="application/x-shockwave-flash" data="<?php echo $cuef_securimage_webpath; ?>/securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?>/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" height="19" width="19"><param name="movie" value="<?php echo $cuef_securimage_webpath; ?>/securimage_play.swf?audio=<?php echo $cuef_securimage_webpath; ?>/securimage_play.php&bgColor1=#fff&bgColor2=#fff&iconColor=#777&borderWidth=1&borderColor=#000" /></object>
|
947 |
<br /><br /><br /><br />
|
948 |
+
<a align="right" tabindex="<?php echo $tabindex; $tabindex++; ?>" style="border-style: none" href="#" onclick="document.getElementById('captcha').src = '<?php echo $cuef_securimage_webpath; ?>/securimage_show_captcha.php?' + Math.random(); return false"><img src="<?php echo $cuef_securimage_webpath; ?>/images/refresh.gif" alt="<?php _e("Change image", $cimy_uef_domain); ?>" border="0" onclick="this.blur()" align="bottom" /></a>
|
949 |
</div>
|
950 |
<div style="width: 278px; float: left; height: 50px; vertical-align: bottom; padding: 5px;">
|
951 |
<?php _e("Insert the code:", $cimy_uef_domain); ?> <input type="text" name="securimage_response_field" size="10" maxlength="6" tabindex="<?php echo $tabindex; $tabindex++; ?>" />
|
cimy_user_extra_fields.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Cimy User Extra Fields
|
4 |
Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
|
5 |
Plugin Description: Add some useful fields to registration and user's info
|
6 |
-
Version: 2.0.
|
7 |
Author: Marco Cimmino
|
8 |
Author URI: mailto:cimmino.marco@gmail.com
|
9 |
*/
|
@@ -145,20 +145,36 @@ if (is_multisite()) {
|
|
145 |
$cuef_plugin_path = "cimy-user-extra-fields/";
|
146 |
|
147 |
$cuef_plugin_dir.= $cuef_plugin_path;
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
else {
|
153 |
$cuef_plugin_dir = WP_CONTENT_DIR."/plugins/".$cuef_plugin_path;
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
}
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
require_once($cuef_plugin_dir.'/cimy_uef_email_handler.php');
|
164 |
require_once($cuef_plugin_dir.'/cimy_uef_db.php');
|
@@ -169,7 +185,7 @@ require_once($cuef_plugin_dir.'/cimy_uef_options.php');
|
|
169 |
require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
|
170 |
|
171 |
$cimy_uef_name = "Cimy User Extra Fields";
|
172 |
-
$cimy_uef_version = "2.0.
|
173 |
$cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
|
174 |
$cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
|
175 |
|
@@ -578,6 +594,9 @@ add_action('delete_user', 'cimy_delete_user_info');
|
|
578 |
// add avatar filter
|
579 |
add_filter('get_avatar', 'cimy_uef_avatar_filter', 1, 5);
|
580 |
|
|
|
|
|
|
|
581 |
function cimy_uef_avatar_filter($avatar, $id_or_email, $size, $default, $alt="") {
|
582 |
global $wpdb, $wpdb_data_table, $wpdb_fields_table, $cuef_upload_path;
|
583 |
|
@@ -725,18 +744,19 @@ function cimy_admin_menu_custom() {
|
|
725 |
if (isset($cimy_top_menu) && (!is_multisite())) {
|
726 |
add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Options"), "UEF: ".__("Options"), 'manage_options', "user_extra_fields_options", 'cimy_show_options_notembedded');
|
727 |
add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Fields", $cimy_uef_domain), "UEF: ".__("Fields", $cimy_uef_domain), 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
728 |
-
add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
|
729 |
}
|
730 |
else {
|
731 |
if ((is_multisite()) && ($cimy_uef_plugins_dir == "mu-plugins")) {
|
732 |
-
add_submenu_page('wpmu-admin.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'manage_options', "users_extended", 'cimy_admin_users_list_page');
|
733 |
add_submenu_page('wpmu-admin.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
734 |
}
|
735 |
else {
|
736 |
add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
737 |
-
add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
|
738 |
}
|
739 |
}
|
|
|
740 |
}
|
741 |
|
742 |
function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="") {
|
3 |
Plugin Name: Cimy User Extra Fields
|
4 |
Plugin URI: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
|
5 |
Plugin Description: Add some useful fields to registration and user's info
|
6 |
+
Version: 2.0.1
|
7 |
Author: Marco Cimmino
|
8 |
Author URI: mailto:cimmino.marco@gmail.com
|
9 |
*/
|
145 |
$cuef_plugin_path = "cimy-user-extra-fields/";
|
146 |
|
147 |
$cuef_plugin_dir.= $cuef_plugin_path;
|
148 |
+
// $cuef_css_webpath = WP_CONTENT_URL."/".$cimy_uef_plugins_dir."/".$cuef_plugin_path."css/";
|
149 |
+
// $cuef_js_webpath = WP_CONTENT_URL."/".$cimy_uef_plugins_dir."/".$cuef_plugin_path."js/";
|
150 |
+
// $cuef_securimage_webpath = WP_CONTENT_URL."/".$cimy_uef_plugins_dir."/".$cuef_plugin_path."securimage/";
|
151 |
}
|
152 |
else {
|
153 |
$cuef_plugin_dir = WP_CONTENT_DIR."/plugins/".$cuef_plugin_path;
|
154 |
+
// $cuef_css_webpath = WP_CONTENT_URL."/plugins/".$cuef_plugin_path."css/";
|
155 |
+
// $cuef_js_webpath = WP_CONTENT_URL."/plugins/".$cuef_plugin_path."js/";
|
156 |
+
// $cuef_securimage_webpath = WP_CONTENT_URL."/plugins/".$cuef_plugin_path."securimage/";
|
157 |
}
|
158 |
|
159 |
+
// let's use plugins_url to build urls, take in account https too
|
160 |
+
$cimy_uef_plugins_dirprefix = "";
|
161 |
+
if ($cimy_uef_plugins_dir == "mu-plugins")
|
162 |
+
$cimy_uef_plugins_dirprefix = $cuef_plugin_path;
|
163 |
+
|
164 |
+
$cuef_css_webpath = plugins_url($cimy_uef_plugins_dirprefix."css", __FILE__);
|
165 |
+
$cuef_js_webpath = plugins_url($cimy_uef_plugins_dirprefix."js", __FILE__);
|
166 |
+
$cuef_securimage_webpath = plugins_url($cimy_uef_plugins_dirprefix."securimage", __FILE__);
|
167 |
+
|
168 |
+
wp_register_script("cimy_uef_upload_file", $cuef_js_webpath."/upload_file.js", false, false);
|
169 |
+
wp_register_style("cimy_uef_register", $cuef_css_webpath."/cimy_uef_register.css", false, false);
|
170 |
+
|
171 |
+
function cimy_uef_admin_init() {
|
172 |
+
global $cuef_js_webpath;
|
173 |
+
wp_register_script("cimy_uef_invert_sel", $cuef_js_webpath."/invert_sel.js", false, false);
|
174 |
+
wp_register_script("cimy_uef_ajax_new_value", $cuef_js_webpath."/ajax_new_value.js", false, false);
|
175 |
+
}
|
176 |
+
|
177 |
+
add_action('admin_init', 'cimy_uef_admin_init');
|
178 |
|
179 |
require_once($cuef_plugin_dir.'/cimy_uef_email_handler.php');
|
180 |
require_once($cuef_plugin_dir.'/cimy_uef_db.php');
|
185 |
require_once($cuef_plugin_dir.'/cimy_uef_admin.php');
|
186 |
|
187 |
$cimy_uef_name = "Cimy User Extra Fields";
|
188 |
+
$cimy_uef_version = "2.0.1";
|
189 |
$cimy_uef_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/";
|
190 |
$cimy_project_url = "http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/";
|
191 |
|
594 |
// add avatar filter
|
595 |
add_filter('get_avatar', 'cimy_uef_avatar_filter', 1, 5);
|
596 |
|
597 |
+
// add code to handle new value from ajax code in A&U Extended
|
598 |
+
add_action('wp_ajax_save-extra-field-new-value', 'cimy_uef_admin_ajax_save_ef_new_value');
|
599 |
+
|
600 |
function cimy_uef_avatar_filter($avatar, $id_or_email, $size, $default, $alt="") {
|
601 |
global $wpdb, $wpdb_data_table, $wpdb_fields_table, $cuef_upload_path;
|
602 |
|
744 |
if (isset($cimy_top_menu) && (!is_multisite())) {
|
745 |
add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Options"), "UEF: ".__("Options"), 'manage_options', "user_extra_fields_options", 'cimy_show_options_notembedded');
|
746 |
add_submenu_page('cimy_series.php', $cimy_uef_name.": ".__("Fields", $cimy_uef_domain), "UEF: ".__("Fields", $cimy_uef_domain), 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
747 |
+
$aue_page = add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
|
748 |
}
|
749 |
else {
|
750 |
if ((is_multisite()) && ($cimy_uef_plugins_dir == "mu-plugins")) {
|
751 |
+
$aue_page = add_submenu_page('wpmu-admin.php', __("Users Extended", $cimy_uef_domain), __("Users Extended", $cimy_uef_domain), 'manage_options', "users_extended", 'cimy_admin_users_list_page');
|
752 |
add_submenu_page('wpmu-admin.php', $cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
753 |
}
|
754 |
else {
|
755 |
add_options_page($cimy_uef_name, $cimy_uef_name, 'manage_options', "user_extra_fields", 'cimy_admin_define_extra_fields');
|
756 |
+
$aue_page = add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 'manage_options', "au_extended", 'cimy_admin_users_list_page');
|
757 |
}
|
758 |
}
|
759 |
+
add_action('admin_print_scripts-'.$aue_page, 'cimy_uef_admin_ajax_edit');
|
760 |
}
|
761 |
|
762 |
function cimy_manage_upload($input_name, $user_login, $rules, $old_file=false, $delete_file=false, $type="") {
|
js/ajax_new_value.js
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
editExtraField = function(user_id, field_name) {
|
3 |
+
var e = $('#edit-'+user_id+'-'+field_name), revert_e = e.html(), new_html;
|
4 |
+
var old_value = $('#value-'+user_id+'-'+field_name).html();
|
5 |
+
var all_inside_ef_td = $('#ef-new-value-'+field_name).clone();
|
6 |
+
var extra_field = all_inside_ef_td.find(':first-child');
|
7 |
+
var extra_field_type = extra_field.attr('type');
|
8 |
+
|
9 |
+
extra_field.attr('id', 'ef-new-value-'+user_id+'-'+field_name);
|
10 |
+
extra_field.attr('name', '');
|
11 |
+
|
12 |
+
new_html = all_inside_ef_td.html();
|
13 |
+
new_html += '<br /><br /><a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a><br /><br />';
|
14 |
+
e.html(new_html);
|
15 |
+
|
16 |
+
$('#ef-new-value-'+user_id+'-'+field_name).keypress(function(f){
|
17 |
+
var key = f.keyCode || 0;
|
18 |
+
// on enter, just save the new slug, don't save the post
|
19 |
+
if ( 13 == key ) {
|
20 |
+
e.children('.save').click();
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
if ( 27 == key ) {
|
24 |
+
e.children('.cancel').click();
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
if (extra_field_type == 'select-multiple')
|
30 |
+
$('#ef-new-value-'+user_id+'-'+field_name).val(old_value.split(','));
|
31 |
+
else
|
32 |
+
$('#ef-new-value-'+user_id+'-'+field_name).val(old_value);
|
33 |
+
|
34 |
+
$('#ef-new-value-'+user_id+'-'+field_name).focus();
|
35 |
+
if (extra_field_type == 'checkbox' && old_value == "YES")
|
36 |
+
$('#ef-new-value-'+user_id+'-'+field_name).attr("checked", true);
|
37 |
+
|
38 |
+
$('.cancel').click(function() {
|
39 |
+
e.html(revert_e);
|
40 |
+
});
|
41 |
+
|
42 |
+
$('.save').click(function() {
|
43 |
+
var new_value, cFlag = false;
|
44 |
+
if (extra_field_type == 'checkbox') {
|
45 |
+
cFlag = $('#ef-new-value-'+user_id+'-'+field_name).is(':checked');
|
46 |
+
cFlag ? new_value = '1' : new_value = '';
|
47 |
+
}
|
48 |
+
else
|
49 |
+
new_value = $('#ef-new-value-'+user_id+'-'+field_name).val();
|
50 |
+
|
51 |
+
if (extra_field_type == 'select-multiple') {
|
52 |
+
if (new_value == null)
|
53 |
+
new_value = Array();
|
54 |
+
|
55 |
+
if($.inArray(postL10n.dropdown_first_item, new_value) > -1)
|
56 |
+
new_value.splice(0, 1);
|
57 |
+
|
58 |
+
new_value = new_value.join(',');
|
59 |
+
}
|
60 |
+
|
61 |
+
if (extra_field_type == 'select-one' && new_value == postL10n.dropdown_first_item) {
|
62 |
+
e.html(revert_e);
|
63 |
+
} else {
|
64 |
+
$.post(ajaxurl, {
|
65 |
+
action: 'save-extra-field-new-value',
|
66 |
+
user_id: user_id,
|
67 |
+
field_name: field_name,
|
68 |
+
new_value: new_value,
|
69 |
+
extrafieldnewvaluenonce: $('#extrafieldnewvaluenonce').val()
|
70 |
+
}, function(response) {
|
71 |
+
var new_value_c;
|
72 |
+
if (response != null) {
|
73 |
+
new_value_c = new_value;
|
74 |
+
if (extra_field_type == 'checkbox')
|
75 |
+
cFlag ? new_value_c = "YES" : new_value_c = "NO";
|
76 |
+
}
|
77 |
+
else
|
78 |
+
new_value_c = old_value
|
79 |
+
|
80 |
+
e.html(revert_e);
|
81 |
+
$('#value-'+user_id+'-'+field_name).html(new_value_c);
|
82 |
+
});
|
83 |
+
}
|
84 |
+
});
|
85 |
+
}
|
86 |
+
});
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Contributors: Marco Cimmino
|
3 |
Donate link: http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/
|
4 |
Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
|
5 |
-
Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar
|
6 |
Requires at least: 3.0
|
7 |
Tested up to: 3.0
|
8 |
-
Stable tag: 2.0.
|
9 |
|
10 |
Add some useful fields to registration and user's info
|
11 |
|
2 |
Contributors: Marco Cimmino
|
3 |
Donate link: http://www.marcocimmino.net/cimy-wordpress-plugins/support-the-cimy-project-paypal/
|
4 |
Website link: http://www.marcocimmino.net/cimy-wordpress-plugins/cimy-user-extra-fields/
|
5 |
+
Tags: cimy, admin, registration, profile, extra fields, avatar, gravatar, recaptcha, captcha
|
6 |
Requires at least: 3.0
|
7 |
Tested up to: 3.0
|
8 |
+
Stable tag: 2.0.1
|
9 |
|
10 |
Add some useful fields to registration and user's info
|
11 |
|