Changeset 2872446
- Timestamp:
- 02/28/2023 02:54:23 PM (3 years ago)
- Location:
- dynamic-user-directory/trunk
- Files:
-
- 5 edited
-
dynamic-user-directory.php (modified) (1 diff)
-
includes/admin.php (modified) (11 diffs)
-
includes/core.php (modified) (6 diffs)
-
js/jquery.user-directory.js (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dynamic-user-directory/trunk/dynamic-user-directory.php
r2787766 r2872446 3 3 * Plugin URI: http://sgcustomwebsolutions.com 4 4 * Description: Creates an alphabetically sorted user directory that will format and display specified user meta data such as name, address, and email. 5 * Version: 1.6. 75 * Version: 1.6.8 6 6 * Author: Sarah Giles 7 7 * Author URI: http://sgcustomwebsolutions.com -
dynamic-user-directory/trunk/includes/admin.php
r2787766 r2872446 223 223 'ud_col_width_address' => '', 224 224 'ud_col_width_social' => '', 225 'ud_col_width_roles' => '', 225 226 'ud_col_width_1' => '', 226 227 'ud_col_width_2' => '', … … 256 257 'ud_col_label_website' => '', 257 258 'ud_col_label_date' => '', 259 'ud_col_label_roles' => '', 258 260 'ud_col_label_address' => '', 259 261 'ud_col_label_social' => '', … … 367 369 'ud_date_registered_format' => '', 368 370 'ud_date_lbl' => '', 371 'ud_roles_lbl' => '', 369 372 'ud_email_lbl' => '', 370 373 'ud_website_lbl' => '', … … 372 375 'ud_show_fld_lbl_for_empty_fld' => 'no', 373 376 'ud_website_format' => 'main', 374 'ud_scroll_to_dir_top' => 'no' 377 'ud_scroll_to_dir_top' => 'no', 378 'ud_show_user_roles' => '', 379 'ud_user_roles_format' => '' 375 380 ); 376 381 … … 1817 1822 <td></td> 1818 1823 </tr> 1824 <tr> 1825 <td><b>Show User Roles</b> <input name="<?php echo $dud_option_name;?>[ud_show_user_roles]" id="ud_show_user_roles" type="checkbox" value="1" 1826 <?php if(!empty($dud_options['ud_show_user_roles'])) { checked( '1', $dud_options['ud_show_user_roles'] ); } ?> /></td> 1827 <td><b>User Roles Format</b><br> 1828 <select class="dd-menu-no-chk-box-width" name="<?php echo $dud_option_name;?>[ud_user_roles_format]"> 1829 <OPTION value="1" <?php echo (!empty($dud_options['ud_user_roles_format']) && $dud_options['ud_user_roles_format'] == "1") ? "SELECTED" : ""; ?>>Comma Delimited List</OPTION> 1830 <OPTION value="2" <?php echo (!empty($dud_options['ud_user_roles_format']) && $dud_options['ud_user_roles_format'] == "2") ? "SELECTED" : ""; ?>>Bulleted List</OPTION> 1831 </select></td> 1832 <td>Check this box to show a list of the WordPress user roles assigned to each user in the directory listing.</td> 1833 <td></td> 1834 </tr> 1819 1835 <tr> 1820 1836 <td><b>Show Date Registered</b> <input name="<?php echo $dud_option_name;?>[ud_date_registered]" id="ud_date_registered" type="checkbox" value="1" … … 1841 1857 value="<?php echo !empty($dud_options['ud_date_lbl']) ? esc_attr( $dud_options['ud_date_lbl'] ) : ""; ?>" /></td> 1842 1858 <td>Enter a label for the date registered. If left blank, no label will be shown.</td> 1859 <td></td> 1860 </tr> 1861 <tr id="roles_lbl_row"> 1862 <td><b>User Roles Label</b></td> 1863 <td><input type="text" id="ud_roles_lbl" class="dd-menu-no-chk-box-width" name="<?php echo $dud_option_name;?>[ud_roles_lbl]" 1864 value="<?php echo !empty($dud_options['ud_roles_lbl']) ? esc_attr( $dud_options['ud_roles_lbl'] ) : ""; ?>" /></td> 1865 <td>Enter a label for the user roles. If left blank, no label will be shown.</td> 1843 1866 <td></td> 1844 1867 </tr> … … 2288 2311 <td><div id="date_registered_label"><b>Date Registered Heading Label</b><br><input class="dd-menu-chk-box-width" type="text" id="ud_col_label_date" name="<?php echo $dud_option_name;?>[ud_col_label_date]" 2289 2312 value="<?php echo !empty($dud_options['ud_col_label_date']) ? esc_attr( $dud_options['ud_col_label_date'] ) : ""; ?>" size="2" maxlength="40"/></div></td> 2313 <td></td> 2314 <td></td> 2315 </tr> 2316 2317 <tr id="col_width_user_roles"> 2318 <td><b>User Roles Col Width</b><br><input class="dd-menu-chk-box-width" type="text" id="ud_col_width_roles" name="<?php echo $dud_option_name;?>[ud_col_width_roles]" 2319 value="<?php echo !empty($dud_options['ud_col_width_roles']) ? esc_attr( $dud_options['ud_col_width_roles'] ) : ""; ?>" size="2" maxlength="2"/> %</td> 2320 <td><div id="roles_label"><b>User Roles Heading Label</b><br><input class="dd-menu-chk-box-width" type="text" id="ud_col_label_roles" name="<?php echo $dud_option_name;?>[ud_col_label_roles]" 2321 value="<?php echo !empty($dud_options['ud_col_label_roles']) ? esc_attr( $dud_options['ud_col_label_roles'] ) : ""; ?>" size="2" maxlength="40"/></div></td> 2290 2322 <td></td> 2291 2323 <td></td> … … 3008 3040 if(strpos($input, 'Social') === FALSE) $input .= ',Social'; 3009 3041 if(strpos($input, 'DateRegistered') === FALSE) $input .= ',DateRegistered'; 3042 if(strpos($input, 'UserRoles') === FALSE) $input .= ',UserRoles'; 3010 3043 3011 3044 $output = explode(',', $input); … … 3013 3046 else 3014 3047 { 3015 $output = "Address,Social,Email,Website,DateRegistered, MetaKey1,MetaKey2,MetaKey3,MetaKey4,MetaKey5,MetaKey6,MetaKey7,MetaKey8,MetaKey9,MetaKey10";3048 $output = "Address,Social,Email,Website,DateRegistered,UserRoles,MetaKey1,MetaKey2,MetaKey3,MetaKey4,MetaKey5,MetaKey6,MetaKey7,MetaKey8,MetaKey9,MetaKey10"; 3016 3049 $output = explode(',', $output); 3017 3050 } … … 3518 3551 3519 3552 3520 function my_plugin_notice() {3553 /*function my_plugin_notice() { 3521 3554 $user_id = get_current_user_id(); 3522 3555 if ( !get_user_meta( $user_id, 'complete_1_6_5_update_notice_dismissed' ) && current_user_can('administrator') ) … … 3534 3567 add_user_meta( $user_id, 'complete_1_6_5_update_notice_dismissed', 'true', true ); 3535 3568 } 3536 add_action( 'admin_init', 'my_plugin_notice_dismissed' ); 3569 add_action( 'admin_init', 'my_plugin_notice_dismissed' );*/ -
dynamic-user-directory/trunk/includes/core.php
r2787766 r2872446 600 600 $ud_website_format = !empty($dud_options['ud_website_format']) ? $dud_options['ud_website_format'] : ""; 601 601 $ud_date_lbl = !empty($dud_options['ud_date_lbl']) ? $dud_options['ud_date_lbl'] : ""; 602 $ud_roles_lbl = !empty($dud_options['ud_roles_lbl']) ? $dud_options['ud_roles_lbl'] : ""; 602 603 $ud_show_fld_lbl_for_empty_fld = !empty($dud_options['ud_show_fld_lbl_for_empty_fld']) ? $dud_options['ud_show_fld_lbl_for_empty_fld'] : ""; 604 $ud_show_user_roles = !empty($dud_options['ud_show_user_roles']) ? $dud_options['ud_show_user_roles'] : ""; 605 $ud_user_roles_format = !empty($dud_options['ud_user_roles_format']) ? $dud_options['ud_user_roles_format'] : ""; 603 606 604 607 //Export Add-on … … 991 994 $var_1 = ""; 992 995 $var_2 = ""; 996 $user_roles = ""; 993 997 994 998 /*** Pagination: skip UIDs that are not within the index range for the current page ***/ … … 1201 1205 1202 1206 if(!empty($userdata)) 1203 $username = $userdata->user_login; // For cimy plugin - may not be needed 1207 $username = $userdata->user_login; // For cimy plugin - may not be needed 1208 1209 if($ud_show_user_roles) 1210 $user_roles = dud_get_user_roles($user_id, $ud_user_roles_format, $ud_roles_lbl, $ud_display_listings, false); 1204 1211 1205 1212 /*** PREPARE THE DIRECTORY DATA ****************************************************************/ … … 1455 1462 1456 1463 $user_contact_info .= "\t\t\t<div class='dud_field_date_registered'>" . $user_registered . "</div>\n"; 1464 } 1465 } 1466 else if($item === "UserRoles") 1467 { 1468 if(!empty($user_roles) || (!empty($ud_roles_lbl) && $ud_show_fld_lbl_for_empty_fld === "yes")) { 1469 1470 if(!empty($ud_roles_lbl)) 1471 $user_roles = "<strong>" . $ud_roles_lbl . "</strong> " . $user_roles; 1472 1473 $user_contact_info .= "\t\t\t<div class='dud_field_user_roles'>" . $user_roles . "</div>\n"; 1457 1474 } 1458 1475 } … … 2506 2523 else 2507 2524 { 2508 $output = "Address,Social,Email,Website,DateRegistered, MetaKey1,MetaKey2,MetaKey3,MetaKey4,MetaKey5,MetaKey6,MetaKey7,MetaKey8,MetaKey9,MetaKey10";2525 $output = "Address,Social,Email,Website,DateRegistered,UserRoles,MetaKey1,MetaKey2,MetaKey3,MetaKey4,MetaKey5,MetaKey6,MetaKey7,MetaKey8,MetaKey9,MetaKey10"; 2509 2526 $output = explode(',', $output); 2510 2527 } … … 3293 3310 } 3294 3311 3312 function dud_get_user_roles($user_id, $ud_user_roles_format, $ud_roles_lbl, $ud_display_listings, $ud_export) { 3313 3314 global $wpdb; 3315 global $wp_roles; 3316 3317 $roles_sql = ""; 3318 $role_cnt = 1; 3319 3320 $roles_sql = "SELECT meta_value FROM " . DUD_WPDB_PREFIX . "usermeta WHERE " . DUD_WPDB_PREFIX . "usermeta.meta_key like '%capabilities' AND user_id = $user_id"; 3321 3322 $roles = $wpdb->get_results($roles_sql); 3323 3324 $wproles = $wp_roles->get_names(); 3325 3326 $list_of_roles = ""; 3327 3328 foreach($roles as $user_roles) 3329 { 3330 $role_list = $user_roles->meta_value; 3331 3332 foreach($wproles as $key => $val) 3333 { 3334 if (!stristr($role_list, $key)) 3335 continue; 3336 3337 if($ud_user_roles_format == "1" || $ud_export) 3338 { 3339 if($role_cnt > 1) 3340 $list_of_roles .= ", "; 3341 3342 $list_of_roles .= $val; 3343 } 3344 else 3345 { 3346 if($role_cnt == 1 && !empty($ud_roles_lbl) && $ud_display_listings !== "horizontally") 3347 $list_of_roles .= "<BR>"; 3348 3349 $list_of_roles .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $val . "<BR>"; 3350 } 3351 3352 $role_cnt++; 3353 } 3354 } 3355 3356 return $list_of_roles; 3357 } 3358 3295 3359 function dynamic_ud_build_inc_exc_query($sort_fld, $ud_hide_roles, $exc_inc_radio, $inc_exc_user_ids) { 3296 3360 -
dynamic-user-directory/trunk/js/jquery.user-directory.js
r2787766 r2872446 59 59 $("#address_label").show(); 60 60 $("#social_label").show(); 61 $("#date_registered_label").show(); 62 $("#roles_label").show(); 61 63 62 64 for(var i=1; i<11; i++) … … 73 75 $("#address_label").hide(); 74 76 $("#social_label").hide(); 77 $("#date_registered_label").hide(); 78 $("#roles_label").hide(); 75 79 76 80 for(var i=1; i<11; i++) … … 108 112 $("#address_label").hide(); 109 113 $("#social_label").hide(); 114 $("#date_registered_label").hide(); 115 $("#roles_label").hide(); 110 116 111 117 for(var i=1; i<11; i++) … … 1329 1335 $("#social_label").show(); 1330 1336 $("#date_registered_label").show(); 1337 $("#roles_label").show(); 1331 1338 1332 1339 for(var i=1; i<11; i++) … … 1351 1358 $("#social_label").hide(); 1352 1359 $("#date_registered_label").hide(); 1360 $("#roles_label").hide(); 1353 1361 1354 1362 for(var i=1; i<11; i++) … … 1379 1387 $("#social_label").show(); 1380 1388 $("#date_registered_label").show(); 1389 $("#roles_label").show(); 1381 1390 1382 1391 for(var i=1; i<11; i++) … … 1397 1406 $("#social_label").hide(); 1398 1407 $("#date_registered_label").hide(); 1408 $("#roles_label").hide(); 1399 1409 1400 1410 for(var i=1; i<11; i++) … … 1460 1470 1461 1471 $("#Email").hide(); 1462 } 1472 } 1473 1474 if ($("#ud_show_user_roles").is(':checked')) 1475 { 1476 try { 1477 if ($("#ud_display_listings").val() == 'horizontally') 1478 { 1479 $("#col_width_user_roles").show(); 1480 if ($("#ud_show_heading_labels").is(':checked')) 1481 $("#roles_label").show(); 1482 else 1483 $("#roles_label").hide(); 1484 1485 $("#roles_lbl_row").hide(); 1486 $("#roles_format_row").show(); 1487 } 1488 else 1489 { 1490 $("#roles_lbl_row").show(); 1491 $("#roles_format_row").show(); 1492 } 1493 } 1494 catch(err){;} 1495 1496 $("#UserRoles").show(); 1497 } 1498 else 1499 { 1500 try { 1501 if ($("#ud_display_listings").val() == 'horizontally') 1502 { 1503 $("#col_width_user_roles").hide(); 1504 $("#roles_label").hide(); 1505 $("#roles_lbl_row").hide(); 1506 $("#roles_format_row").hide(); 1507 } 1508 else 1509 { 1510 $("#roles_lbl_row").hide(); 1511 $("#roles_format_row").hide(); 1512 } 1513 } 1514 catch(err){;} 1515 1516 $("#UserRoles").hide(); 1517 } 1518 1519 1463 1520 }); 1464 1521 … … 1525 1582 }); 1526 1583 }); 1527 1584 1585 $(function() { 1586 $('#ud_show_user_roles').change(function() { 1587 1588 if ($("#ud_show_user_roles").is(':checked')) 1589 { 1590 try { 1591 if ($("#ud_display_listings").val() == 'horizontally') 1592 { 1593 $("#col_width_user_roles").show(); 1594 if ($("#ud_show_heading_labels").is(':checked')) 1595 $("#roles_label").show(); 1596 else 1597 $("#roles_label").hide(); 1598 1599 $("#roles_lbl_row").hide(); 1600 $("#roles_format_row").show(); 1601 } 1602 else 1603 { 1604 $("#roles_lbl_row").show(); 1605 $("#roles_format_row").show(); 1606 } 1607 } 1608 catch(err){;} 1609 1610 $("#UserRoles").show(); 1611 } 1612 else 1613 { 1614 try { 1615 if ($("#ud_display_listings").val() == 'horizontally') 1616 { 1617 $("#col_width_user_roles").hide(); 1618 $("#roles_label").hide(); 1619 $("#roles_lbl_row").hide(); 1620 $("#roles_format_row").hide(); 1621 } 1622 else 1623 { 1624 $("#roles_lbl_row").hide(); 1625 $("#roles_format_row").hide(); 1626 } 1627 } 1628 catch(err){;} 1629 1630 $("#UserRoles").hide(); 1631 } 1632 1633 var Order = $("#sortable").sortable('toArray').toString(); 1634 $('#user_directory_sort_order').val(Order); 1635 }); 1636 }); 1637 1528 1638 $(document).ready(function() { 1529 1639 if ($("#user_directory_address").val() == "1") … … 2098 2208 $(this).css('cursor','pointer'); 2099 2209 }); 2210 $('#UserRoles').hover(function() { 2211 $(this).css('cursor','pointer'); 2212 }); 2100 2213 $('#MetaKey1').hover(function() { 2101 2214 $(this).css('cursor','pointer'); -
dynamic-user-directory/trunk/readme.txt
r2787766 r2872446 3 3 Contributors: Sarah_Dev 4 4 Donate link: http://sgcustomwebsolutions.com/wordpress-plugin-development/ 5 Tags: user directory, MemberPress, BuddyPress, Cimy User Extra Fields, user registration, user meta fields, profile fields, member directory, website directory, directory, user listing, users, members, user profile, user profiles5 Tags: user directory, MemberPress, BuddyPress, member directory, user registration, user meta fields, profile fields, member directory, website directory, directory, user listing, users, members, user profile, user profiles 6 6 Requires at least: 3.0.1 7 Tested up to: 6. 0.28 Stable tag: 1.6. 77 Tested up to: 6.1.1 8 Stable tag: 1.6.8 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 98 98 == Changelog == 99 99 100 = 1.6.8 = 101 - Released 3/01/23 102 - Successfully tested against WordPress 6.1.1 103 - New Feature: Added the option to display the user roles assigned to each member in the directory listings. Option is located under the "Meta Field Settings" section. If you do not see the new setting option after running the update, try clearing your browser's cache. 104 - Removed admin notice pertaining to DUD 1.6.5 105 100 106 = 1.6.7 = 101 107 - Released 9/20/22
Note: See TracChangeset
for help on using the changeset viewer.