We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When going to view a members map, I dont see any markers at all on my map, in my debug I'm getting:
`[27-Feb-2025 15:11:22 UTC] Array ( ) [27-Feb-2025 15:11:22 UTC] Head Offices: Array ( [0] => 1090 [1] => 1091 [2] => 1093 [3] => 1095 [4] => 1096 [5] => 1097 [6] => 1098 [7] => 1099 [8] => 1100 [9] => 1101 [10] => 1102 [11] => 1103 [12] => 1106 [13] => 1107 [14] => 1108 [15] => 1111 [16] => 1112 [17] => 1113 [18] => 1114 [19] => 1115 [20] => 474 [21] => 1117 [22] => 1118 [23] => 1119 [24] => 1120 [25] => 1121 [26] => 1123 [27] => 1124 [28] => 1125 [29] => 1126 [30] => 1127 [31] => 1128 [32] => 1129 [33] => 1132 [34] => 1139 [35] => 1141 [36] => 1143 [37] => 1144 [38] => 1147 [39] => 1148 [40] => 1149 [41] => 1150 [42] => 1151 [43] => 1152 [44] => 1154 [45] => 1155 [46] => 1157 [47] => 1159 [48] => 1160 [49] => 1162 [50] => 1163 [51] => 1164 [52] => 1165 [53] => 1166 [54] => 1167 [55] => 1168 [56] => 1171 [57] => 1173 [58] => 1174 [59] => 1180 [60] => 1181 [61] => 1182 [62] => 1187 [63] => 1190 [64] => 1193 [65] => 1195 [66] => 1196 [67] => 1197 [68] => 1199 [69] => 1200 [70] => 1203 [71] => 1205 [72] => 1206 [73] => 1209 [74] => 1214 [75] => 1218 [76] => 1219 [77] => 1220 [78] => 1222 [79] => 1223 [80] => 1224 [81] => 1227 [82] => 1228 [83] => 1230 [84] => 1231 [85] => 1233 [86] => 1234 [87] => 1235 [88] => 1237 [89] => 1238 [90] => 1240 [91] => 1241 [92] => 1243 [93] => 1244 [94] => 1246 [95] => 1250 [96] => 1251 [97] => 1116 [98] => 1122 [99] => 1146 [100] => 1170 [101] => 1185 [102] => 1092 [103] => 1135 [104] => 1140 [105] => 1161 [106] => 1189 [107] => 1239 [108] => 1236 ) [27-Feb-2025 15:11:22 UTC] Branches: Array ( [0] => 1571 [1] => 1636 [2] => 1664 [3] => 1687 [4] => 1709 [5] => 1710 [6] => 1711 [7] => 1712 [8] => 1741 [9] => 1742 [10] => 1743 [11] => 1744 [12] => 1745 [13] => 1746 [14] => 1751 [15] => 1752 [16] => 1756 [17] => 1757 [18] => 1784 [19] => 1791 [20] => 1792 [21] => 1793 [22] => 1794 [23] => 1795 [24] => 1796 [25] => 1797 [26] => 1798 [27] => 1799 [28] => 1800 [29] => 1801 [30] => 1802 [31] => 1803 [32] => 1804 [33] => 1805 [34] => 1806 [35] => 1807 [36] => 1808 [37] => 1809 [38] => 1810 [39] => 1811 [40] => 1812 [41] => 1813 [42] => 1814 [43] => 1815 [44] => 1816 [45] => 1817 [46] => 1818 [47] => 1819 [48] => 1820 [49] => 1821 [50] => 1822 [51] => 1823 [52] => 1824 [53] => 1825 [54] => 1826 [55] => 1827 [56] => 1828 [57] => 1829 [58] => 1830 [59] => 1831 [60] => 1832 [61] => 1840 [62] => 1844 [63] => 1845 [64] => 1897 [65] => 1906 [66] => 1907 [67] => 1921 [68] => 1926 [69] => 1927 [70] => 1950 [71] => 1965 [72] => 1975 [73] => 2078 [74] => 2079 [75] => 2080 [76] => 2081 [77] => 2265 [78] => 2303 [79] => 2313 [80] => 2314 [81] => 2315 [82] => 2316 [83] => 2337 [84] => 2347 [85] => 2348 [86] => 2416 [87] => 2417 [88] => 2418 [89] => 2419 [90] => 2421 [91] => 2422 [92] => 2425 [93] => 2437 [94] => 2438 [95] => 2447 [96] => 2448 [97] => 2470 [98] => 2480 [99] => 2504 [100] => 2524 [101] => 2525 [102] => 2526 [103] => 2527 [104] => 2528 [105] => 2529 [106] => 2540 [107] => 2558 [108] => 2560 [109] => 2563 [110] => 2565 [111] => 2569 [112] => 2570 [113] => 2571 [114] => 2573 [115] => 2574 [116] => 2575 [117] => 2576 [118] => 2591 [119] => 2592 [120] => 2628 ) [27-Feb-2025 15:11:22 UTC] All Valid User IDs: Array ( [0] => 1090 [1] => 1091 [2] => 1093 [3] => 1095 [4] => 1096 [5] => 1097 [6] => 1098 [7] => 1099 [8] => 1100 [9] => 1101 [10] => 1102 [11] => 1103 [12] => 1106 [13] => 1107 [14] => 1108 [15] => 1111 [16] => 1112 [17] => 1113 [18] => 1114 [19] => 1115 [20] => 474 [21] => 1117 [22] => 1118 [23] => 1119 [24] => 1120 [25] => 1121 [26] => 1123 [27] => 1124 [28] => 1125 [29] => 1126 [30] => 1127 [31] => 1128 [32] => 1129 [33] => 1132 [34] => 1139 [35] => 1141 [36] => 1143 [37] => 1144 [38] => 1147 [39] => 1148 [40] => 1149 [41] => 1150 [42] => 1151 [43] => 1152 [44] => 1154 [45] => 1155 [46] => 1157 [47] => 1159 [48] => 1160 [49] => 1162 [50] => 1163 [51] => 1164 [52] => 1165 [53] => 1166 [54] => 1167 [55] => 1168 [56] => 1171 [57] => 1173 [58] => 1174 [59] => 1180 [60] => 1181 [61] => 1182 [62] => 1187 [63] => 1190 [64] => 1193 [65] => 1195 [66] => 1196 [67] => 1197 [68] => 1199 [69] => 1200 [70] => 1203 [71] => 1205 [72] => 1206 [73] => 1209 [74] => 1214 [75] => 1218 [76] => 1219 [77] => 1220 [78] => 1222 [79] => 1223 [80] => 1224 [81] => 1227 [82] => 1228 [83] => 1230 [84] => 1231 [85] => 1233 [86] => 1234 [87] => 1235 [88] => 1237 [89] => 1238 [90] => 1240 [91] => 1241 [92] => 1243 [93] => 1244 [94] => 1246 [95] => 1250 [96] => 1251 [97] => 1116 [98] => 1122 [99] => 1146 [100] => 1170 [101] => 1185 [102] => 1092 [103] => 1135 [104] => 1140 [105] => 1161 [106] => 1189 [107] => 1239 [108] => 1236 [109] => 1571 [110] => 1636 [111] => 1664 [112] => 1687 [113] => 1709 [114] => 1710 [115] => 1711 [116] => 1712 [117] => 1741 [118] => 1742 [119] => 1743 [120] => 1744 [121] => 1745 [122] => 1746 [123] => 1751 [124] => 1752 [125] => 1756 [126] => 1757 [127] => 1784 [128] => 1791 [129] => 1792 [130] => 1793 [131] => 1794 [132] => 1795 [133] => 1796 [134] => 1797 [135] => 1798 [136] => 1799 [137] => 1800 [138] => 1801 [139] => 1802 [140] => 1803 [141] => 1804 [142] => 1805 [143] => 1806 [144] => 1807 [145] => 1808 [146] => 1809 [147] => 1810 [148] => 1811 [149] => 1812 [150] => 1813 [151] => 1814 [152] => 1815 [153] => 1816 [154] => 1817 [155] => 1818 [156] => 1819 [157] => 1820 [158] => 1821 [159] => 1822 [160] => 1823 [161] => 1824 [162] => 1825 [163] => 1826 [164] => 1827 [165] => 1828 [166] => 1829 [167] => 1830 [168] => 1831 [169] => 1832 [170] => 1840 [171] => 1844 [172] => 1845 [173] => 1897 [174] => 1906 [175] => 1907 [176] => 1921 [177] => 1926 [178] => 1927 [179] => 1950 [180] => 1965 [181] => 1975 [182] => 2078 [183] => 2079 [184] => 2080 [185] => 2081 [186] => 2265 [187] => 2303 [188] => 2313 [189] => 2314 [190] => 2315 [191] => 2316 [192] => 2337 [193] => 2347 [194] => 2348 [195] => 2416 [196] => 2417 [197] => 2418 [198] => 2419 [199] => 2421 [200] => 2422 [201] => 2425 [202] => 2437 [203] => 2438 [204] => 2447 [205] => 2448 [206] => 2470 [207] => 2480 [208] => 2504 [209] => 2524 [210] => 2525 [211] => 2526 [212] => 2527 [213] => 2528 [214] => 2529 [215] => 2540 [216] => 2558 [217] => 2560 [218] => 2563 [219] => 2565 [220] => 2569 [221] => 2570 [222] => 2571 [223] => 2573 [224] => 2574 [225] => 2575 [226] => 2576 [227] => 2591 [228] => 2592 [229] => 2628 ) [27-Feb-2025 15:11:22 UTC] Paid Memberships Pro - Membership Maps: INVALID_REQUEST: Invalid request. Missing the 'address', 'components', 'latlng' or 'place_id' parameter. [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1170 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => removal and repatriation services [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): removal and repatriation services [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1170 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1123 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => soft goods and funeral supplies [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): soft goods and funeral supplies [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1123 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1128 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => funeral officiants [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): funeral officiants [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1128 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1090 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => casket and coffin manufacturers [listing_name_2] => soft goods and funeral supplies [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): casket and coffin manufacturers [27-Feb-2025 15:11:22 UTC] Comparing with listing_name_2 (normalized): soft goods and funeral supplies [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1090 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1173 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => funeral officiants [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): funeral officiants [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1173 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1174 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => soft goods and funeral supplies [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): soft goods and funeral supplies [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1174 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1148 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => funeral vehicle sales [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): funeral vehicle sales [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1148 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1112 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => memorials and remembrance [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): memorials and remembrance [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1112 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1106 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => casket and coffin manufacturers [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): casket and coffin manufacturers [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1106 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1224 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => finance and professional services [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): finance and professional services [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_2 [27-Feb-2025 15:11:22 UTC] Skipping empty field: listing_name_3 [27-Feb-2025 15:11:22 UTC] No Match for User ID: 1224 [27-Feb-2025 15:11:22 UTC] Checking Listing Names for User ID: 1147 [27-Feb-2025 15:11:22 UTC] Requested (normalized): it and website [27-Feb-2025 15:11:22 UTC] Normalized User Listing Names: Array ( [listing_name] => it and website [listing_name_2] => [listing_name_3] => ) [27-Feb-2025 15:11:22 UTC] Comparing with listing_name (normalized): it and website [27-Feb-2025 15:11:22 UTC] Match Found for User ID: 1147 on listing_name [27-Feb-2025 15:11:22 UTC] Paid Memberships Pro - Membership Maps: INVALID_REQUEST: Invalid request. Missing the 'address', 'components', 'latlng' or 'place_id' parameter. `
This is a snippet I've added which is supposed to be filtering by levels, listing_name or location:
// Custom filter function to check for numerical mem_no function pmpro_filter_members_with_mem_no($members) { $filtered_members = array(); foreach ($members as $member) { $user_id = $member->ID; $mem_no = get_user_meta($user_id, 'mem_no', true); if (is_numeric($mem_no)) { $filtered_members[] = $member; } } return $filtered_members; } add_filter('pmpromd_user_directory_results', 'pmpro_filter_members_with_mem_no', 10, 1); // Define the widget class if not already defined if ( ! class_exists( 'My_PMPro_Directory_Widget' ) ) { class My_PMPro_Directory_Widget extends WP_Widget { public function __construct() { parent::__construct( 'my_pmpro_directory_widget', 'My PMPro Directory Widget', array( 'description' => 'Filter the PMPro Member Directory' ) ); } public function widget( $args, $instance ) { global $post; if ( ! is_a( $post, 'WP_Post' ) || ! has_shortcode( $post->post_content, 'pmpro_member_directory' ) ) { return; } echo '<aside id="my_pmpro_directory_widget" class="widget my_pmpro_directory_widget">'; echo '<h3 class="widget-title">Filter by Address</h3>'; echo $this->get_search_form_html(); echo '</aside>'; } private function get_search_form_html() { ob_start(); ?> <form class="pmpro_member_directory_search"> <p><label>Location <input type="text" name="location" value="<?php echo ( ! empty( $_REQUEST['location'] ) ) ? urldecode( $_REQUEST['location'] ) : ""; ?>"></label></p> <p><label>Distance <select name='distance'> <?php $distances = array( '5' => '5 miles', '10' => '10 miles', '25' => '25 miles', '50' => '50 miles', 'all' => 'UK Wide', ); foreach ( $distances as $key => $value ) { $selected = ( isset( $_REQUEST['distance'] ) && $key == $_REQUEST['distance'] ) ? ' selected' : ''; echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $value ) . '</option>'; } ?> </select></label></p> <p><input type="submit" value="Search"></p> </form> <?php return ob_get_clean(); } } } // Register the widget function my_pmpro_register_directory_widget() { register_widget( 'My_PMPro_Directory_Widget' ); } add_action( 'widgets_init', 'my_pmpro_register_directory_widget' ); //Member Search Form function pmpro_member_search_shortcode() { ob_start(); ?> <form class="pmpro_member_directory_search"> <input type="hidden" name="levels" value="1,2,3,4,5,6,7,8,9,10,11,12,14,15,17,18,19,20,21,22" /> <p><label>Location <input type="text" name="location" value="<?php echo ( ! empty( $_REQUEST['location'] ) && $_REQUEST['location'] !== "all" ) ? urldecode( $_REQUEST['location'] ) : ""; ?>"></label></p> <p><label>Distance <select name='distance'> <?php $distances = array( '5' => '5 miles', '10' => '10 miles', '25' => '25 miles', '50' => '50 miles', 'all' => 'UK Wide', ); foreach ( $distances as $key => $value ) { $selected = ( isset( $_REQUEST['distance'] ) && $key == $_REQUEST['distance'] ) ? ' selected' : ''; echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $value ) . '</option>'; } ?> </select></label></p> <p><input type="submit" value="Search"></p> </form> <?php return ob_get_clean(); } add_shortcode( 'pmpro_member_search', 'pmpro_member_search_shortcode' ); //Associate Search Form function pmpro_assoc_search_shortcode() { ob_start(); ?> <form class="pmpro_assoc_directory_search"> <input type="hidden" name="levels" value="16,23,41" /> <input type="hidden" name="location" value="all"> <p><label>Category <select name='listing_name'> <option value="">-- Please Select --</option> <?php if ( have_rows('listings_dropdown', 'option') ) { while ( have_rows('listings_dropdown', 'option') ) { the_row(); $listing_value = get_sub_field('listings_name'); $selected = ( ! empty( $_REQUEST['listing_name'] ) && $_REQUEST['listing_name'] == $listing_value ) ? ' selected' : ''; echo '<option value="' . esc_attr( $listing_value ) . '"' . $selected . '>' . esc_html( $listing_value ) . '</option>'; } } ?> </select></label></p> <p><input type="submit" value="Search"></p> </form> <?php return ob_get_clean(); } add_shortcode( 'pmpro_assoc_search', 'pmpro_assoc_search_shortcode' ); // Filter by Distance and Levels, including all 3 listing names function filter_results_by_distance_and_levels( $items, $type ) { if ( ! function_exists( 'pmpromm_geocode_address' ) ) { return $items; } $filter_distance = ! empty( $_REQUEST['distance'] ) && $_REQUEST['distance'] !== 'all'; $filter_levels = ! empty( $_REQUEST['levels'] ); if ( empty( $_REQUEST['location'] ) || ( ! $filter_distance && ! $filter_levels ) ) { return $items; } $member_address = array( 'street' => ( !empty( $_REQUEST['address'] ) ) ? $_REQUEST['address'] : get_user_meta( $user_id, 'address', true ), 'city' => ( !empty( $_REQUEST['towncity'] ) ) ? $_REQUEST['towncity'] : get_user_meta( $user_id, 'towncity', true ), 'state' => ( !empty( $_REQUEST['county'] ) ) ? $_REQUEST['county'] : get_user_meta( $user_id, 'county', true ), 'zip' => ( !empty( $_REQUEST['postcode'] ) ) ? $_REQUEST['postcode'] : get_user_meta( $user_id, 'postcode', true ), 'country' => ( !empty( $_REQUEST['country'] ) ) ? $_REQUEST['country'] : get_user_meta( $user_id, 'country', true ) ); $coordinates = pmpromm_geocode_address( $member_address ); $filtered_items = array(); if ( is_array( $coordinates ) || ! $filter_distance ) { foreach ( $items as $item ) { $user_id = ($type === 'users') ? intval( $item->ID ) : $item['marker_meta']['user_id']; $lat = get_user_meta( $user_id, 'pmpro_lat', true ); $lng = get_user_meta( $user_id, 'pmpro_lng', true ); $user_listing_name = get_user_meta( $user_id, 'listing_name', true ); $user_listing_name_2 = get_user_meta( $user_id, 'listing_name_2', true ); $user_listing_name_3 = get_user_meta( $user_id, 'listing_name_3', true ); $user_level = pmpro_getMembershipLevelForUser( $user_id ); $distance_valid = true; if ( $filter_distance && ! empty( $lat ) && ! empty( $lng ) ) { $distance = mypmpromm_calculate_distance( $coordinates['lat'], $coordinates['lng'], $lat, $lng, 'm' ); $distance_valid = $distance <= $_REQUEST['distance']; } $level_valid = true; if ( $filter_levels ) { $level_valid = in_array( $user_level->ID, explode( ',', $_REQUEST['levels'] ) ); } // Check all listing names for a match $listing_name_match = false; if ( ! empty( $_REQUEST['listing_name'] ) ) { // Normalize the requested listing name $requested_listing_name = strtolower( trim( sanitize_text_field( $_REQUEST['listing_name'] ) ) ); $requested_listing_name = str_replace( '&', 'and', $requested_listing_name ); // Collect and normalize each listing name for accurate comparison $user_listing_names = array( 'listing_name' => strtolower( trim( sanitize_text_field( $user_listing_name ) ) ), 'listing_name_2' => strtolower( trim( sanitize_text_field( $user_listing_name_2 ) ) ), 'listing_name_3' => strtolower( trim( sanitize_text_field( $user_listing_name_3 ) ) ), ); // Replace special characters consistently $user_listing_names = array_map( function( $name ) { return str_replace( '&', 'and', $name ); }, $user_listing_names ); // Log the normalized requested name and the user's listing names error_log("Checking Listing Names for User ID: $user_id"); error_log("Requested (normalized): $requested_listing_name"); error_log("Normalized User Listing Names: " . print_r($user_listing_names, true)); foreach ( $user_listing_names as $field_name => $listing_name ) { // Skip empty fields if ( empty( $listing_name ) ) { error_log("Skipping empty field: $field_name"); continue; } error_log("Comparing with $field_name (normalized): $listing_name"); if ( $listing_name === $requested_listing_name ) { $listing_name_match = true; error_log("Match Found for User ID: $user_id on $field_name"); break; } } if ( ! $listing_name_match ) { error_log("No Match for User ID: $user_id"); } } else { $listing_name_match = true; } if ( $distance_valid && $level_valid && $listing_name_match ) { $filtered_items[] = $item; } } return $filtered_items; } return $items; } // Calculate distance function mypmpromm_calculate_distance( $lat1, $lon1, $lat2, $lon2, $unit ) { $theta = $lon1 - $lon2; $dist = sin( deg2rad( $lat1 ) ) * sin( deg2rad( $lat2 ) ) + cos( deg2rad( $lat1 ) ) * cos( deg2rad( $lat2 ) ) * cos( deg2rad( $theta ) ); $dist = acos( $dist ); $dist = rad2deg( $dist ); $miles = $dist * 60 * 1.1515; $unit = strtoupper( $unit ); if ( $unit === "KM" ) { return ( $miles * 1.609344 ); } else { return $miles; } } function mypmpro_marker_result_distance_filter( $markers ) { return filter_results_by_distance_and_levels( $markers, 'markers' ); } add_filter( 'pmpromm_return_markers_array', 'mypmpro_marker_result_distance_filter', 10, 1 ); // Add filters for user and marker results function mypmpro_result_distance_filter( $theusers ) { return filter_results_by_distance_and_levels( $theusers, 'users' ); } add_filter( 'pmpromd_user_directory_results', 'mypmpro_result_distance_filter', 10, 1 ); // Add pagination URL filter function my_pmpromd_pagination_url_filter_directory( $query_args ) { $directory_filters = array( 'location', 'distance', 'listing_name', 'levels' ); foreach ( $directory_filters as $directory_filter ) { if ( ! empty( $_REQUEST[ $directory_filter ] ) ) { $query_args[ $directory_filter ] = $_REQUEST[ $directory_filter ]; } } return $query_args; } add_filter( 'pmpromd_pagination_url', 'my_pmpromd_pagination_url_filter_directory' );
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When going to view a members map, I dont see any markers at all on my map, in my debug I'm getting:
This is a snippet I've added which is supposed to be filtering by levels, listing_name or location:
The text was updated successfully, but these errors were encountered: