Plugin Directory

Changeset 3093386


Ignore:
Timestamp:
05/27/2024 05:24:34 PM (22 months ago)
Author:
Sarah_Dev
Message:

Version 1.9

  • Released 5/27/24
  • Successfully tested against WordPress 6.5.3.
  • Fixed: Several field formatting options were not working correctly.
  • Enhancement for MemberPress users: Multiselect box and multiple or single checkbox fields will now show the original capitalization configured in MemberPress (with no hyphens) when any of the "Show Labels" format options is selected.
Location:
dynamic-user-directory/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dynamic-user-directory/trunk/dynamic-user-directory.php

    r3049189 r3093386  
    33* Plugin URI: http://sgcustomwebsolutions.com
    44* 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.8
     5* Version: 1.9
    66* Author: Sarah Giles
    77* Author URI: http://sgcustomwebsolutions.com
  • dynamic-user-directory/trunk/includes/admin.php

    r2968851 r3093386  
    19701970                            <OPTION value="2" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "2") ? "SELECTED" : ""; ?>>Hyperlink => Open in Same Window</OPTION>
    19711971                            <OPTION value="3" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "3") ? "SELECTED" : ""; ?>>Hyperlink => Open in New Tab</OPTION>
    1972                             <OPTION value="49" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "49") ? "SELECTED" : ""; ?>>Multiselect => Show Values and Labels (Keep Hyphens)</OPTION>
    1973                             <OPTION value="51" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "51") ? "SELECTED" : ""; ?>>Multiselect => Show Values (Keep Hyphens)</OPTION>
     1972                            <OPTION value="49" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "49") ? "SELECTED" : ""; ?>>Multiselect => Show Values and Labels (Bulleted)</OPTION>
    19741973                            <OPTION value="35" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "35") ? "SELECTED" : ""; ?>>Multiselect => Show Labels (Bulleted)</OPTION>
     1974                            <OPTION value="36" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "36") ? "SELECTED" : ""; ?>>Multiselect => Show Labels (Comma Delimited)</OPTION>
    19751975                            <OPTION value="5" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "5") ? "SELECTED" : ""; ?>>Multiselect => Show Values (Bulleted)</OPTION>
    19761976                            <OPTION value="39" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "39") ? "SELECTED" : ""; ?>>Multiselect => Show Values (All Caps and Bulleted)</OPTION>
    19771977                            <OPTION value="40" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "40") ? "SELECTED" : ""; ?>>Multiselect => Show Values (All Lowercase and Bulleted)</OPTION>
    1978                             <OPTION value="36" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "36") ? "SELECTED" : ""; ?>>Multiselect => Show Labels (Comma Delimited)</OPTION>
    19791978                            <OPTION value="4" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "4") ? "SELECTED" : ""; ?>>Multiselect => Show Values (Comma Delimited)</OPTION> 
    19801979                            <OPTION value="41" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "41") ? "SELECTED" : ""; ?>>Multiselect => Show Values (All Caps and Comma Delimited)</OPTION>       
    19811980                            <OPTION value="42" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "42") ? "SELECTED" : ""; ?>>Multiselect => Show Values (All Lowercase and Comma Delimited)</OPTION> 
    1982                             <OPTION value="50" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "50") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values and Labels (Keep Hyphens)</OPTION>
    1983                             <OPTION value="52" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "52") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (Keep Hyphens)</OPTION>
    1984                             <OPTION value="11" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "11") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Labels (Bulleted)</OPTION>                              
     1981                            <OPTION value="50" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "50") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values and Labels (Bulleted)</OPTION>
     1982                            <OPTION value="11" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "11") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Labels (Bulleted)</OPTION>   
     1983                            <OPTION value="8" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "8") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Labels (Comma Delimited)</OPTION>                     
    19851984                            <OPTION value="45" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "45") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (Bulleted)</OPTION>   
    19861985                            <OPTION value="43" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "43") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (All Caps and Bulleted)</OPTION>
    1987                             <OPTION value="47" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "47") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (All Lowercase and Bulleted)</OPTION>
    1988                             <OPTION value="8" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "8") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Labels (Comma Delimited)</OPTION>                         
     1986                            <OPTION value="47" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "47") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (All Lowercase and Bulleted)</OPTION>     
    19891987                            <OPTION value="46" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "46") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (Comma Delimited)</OPTION>                           
    19901988                            <OPTION value="44" <?php echo (!empty($dud_options['dud_fld_format_' . $inc]) && $dud_options['dud_fld_format_' . $inc] == "44") ? "SELECTED" : ""; ?>>Multiple Checkboxes => Show Values (All Caps and Comma Delimited)</OPTION>   
  • dynamic-user-directory/trunk/includes/core.php

    r2968851 r3093386  
    10721072               $fld_label     = !empty($user_directory_meta_flds_tmp[$inc]['label']) ? $user_directory_meta_flds_tmp[$inc]['label'] : null;     
    10731073               
    1074                $user_directory_meta_flds_tmp[$inc]['value'] =  dynamic_ud_format_meta_val($user_meta_fld, $dud_options, $fld_format, $fld_label);   
     1074               $user_directory_meta_flds_tmp[$inc]['value'] =  dynamic_ud_format_meta_val($user_meta_fld, $dud_options, $fld_format, $fld_label,
     1075                    $user_directory_meta_flds_tmp[$inc]['field']); 
    10751076            }
    10761077        }
     
    19071908}
    19081909
    1909 function dynamic_ud_format_meta_val($user_meta_fld, $dud_options, $format, $label = null)
     1910function dynamic_ud_format_meta_val($user_meta_fld, $dud_options, $format, $label = null, $meta_fld_key_name = null)
    19101911{   
    19111912    $parsed_val = "";
     
    19141915    $ud_display_listings = !empty($dud_options['ud_display_listings']) ? $dud_options['ud_display_listings'] : "";
    19151916    $inc = 1;
    1916                
     1917       
     1918
     1919    if("dev-directory" === $dud_options['dud_instance_name'])
     1920    {
     1921        echo "<BR><BR>In format meta val...<BR>";
     1922    }
     1923   
    19171924    //*** Image ***********************************************
    19181925    if(!is_array($user_meta_fld) && $format === "34")
     
    20072014    //*** Multiselect Boxes & Checkboxes *******************************
    20082015    else if(!is_array($user_meta_fld))
    2009     {
     2016    {       
    20102017        $non_array_numeric_idx = false;
    20112018               
     
    20572064                    else if($format === "11" || $format === "35")
    20582065                        $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key;
    2059                     else if($format === "49")
     2066                    else if($format === "49" || $format === "50")
    20602067                        $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key . ": " . $value;
    2061                     else if($format === "13" || $format === "44" || $format === "49" || $format === "50")
     2068                    else if($format === "13" )
    20622069                        $parsed_val .= $key . ": " . $value;
    20632070                    else if($format === "14" || $format === "8" || $format === "36" )
     
    21252132    }
    21262133    else if(is_array($user_meta_fld))
    2127     {
     2134    {       
    21282135        $inc = 1;
    21292136       
    21302137        foreach ($user_meta_fld as $key => $value)
    21312138        {
     2139            $is_member_press = false;
     2140           
    21322141            if (is_string($key))
    2133             {           
     2142            {              
    21342143                if(is_array($value)) //there are nested arrays
    21352144                    $parsed_val .= "<BR>" . var_export($value, true);   
    2136                 else                 //add key-value pair to the meta fld var
     2145                else                 
    21372146                {
     2147                    //echo "Format var is $format...<BR>";
     2148                   
     2149                    //MemberPress ONLY: Pull the corresponding fld label for all "Show Label" format options
     2150                    if($format === "8" || $format === "11" || $format === "14" || $format === "35" || $format === "36")
     2151                    {
     2152                        $mepr_options = null;
     2153                       
     2154                        try
     2155                        {
     2156                            $mepr_options = MeprOptions::fetch();
     2157                            if(!is_null($mepr_options))
     2158                            {
     2159                                foreach($mepr_options->custom_fields as $line) {
     2160                                   
     2161                                  //echo "Line Field Key: " . $line->field_key . ", DUD Fld Key: " . $meta_fld_key_name . "<BR>";
     2162                                 
     2163                                  if($line->field_key == $meta_fld_key_name) {
     2164                                    foreach($line->options as $option_key => $option_val) {
     2165                                       
     2166                                      $no_hyphens = str_replace ( "-", " ", $user_meta_fld[$met]);
     2167                                       
     2168                                      //echo "Line Option Val: " . $option_val->option_name . ", Meta Fld Val: " . $no_hyphens . "<BR>";
     2169                                       
     2170                                      if(strtoupper($option_val->option_name) === strtoupper($no_hyphens)) {
     2171                                        $value = $option_val->option_name;
     2172                                        $key = $option_val->option_name;
     2173                                        $is_member_press = true;
     2174                                      }
     2175                                    }
     2176                                  }
     2177                                }
     2178                               
     2179                                //echo "<BR>";
     2180                            }
     2181                           
     2182                        }
     2183                        catch(Exception $e)
     2184                        {
     2185                            ;
     2186                        }
     2187                    }
     2188                           
    21382189                    //Hide Hyphens & Capitalization
    2139                     if($format === "5" || $format === "39" || $format === "40"
    2140                        || $format === "4" || $format === "41" || $format === "42"
     2190                    if($format === "5" || $format === "39" || $format === "30"
     2191                       || $format === "37" || $format === "38" || $format === "40"
     2192                       || $format === "4"  || $format === "41" || $format === "42"
    21412193                       || $format === "45" || $format === "43" | $format === "44"
    21422194                       || $format === "47" || $format === "13" || $format === "15"
    21432195                       || $format === "48" || $format === "49" || $format === "50"
    2144                        || $format === "35" || $format === "36" || $format === "11" || $format === "8"
    2145                        || $format === "53" || $format === "54")
     2196                       || $format === "35" || $format === "36" || $format === "11"
     2197                       || $format === "8"  || $format === "53" || $format === "54")
    21462198                    {
    21472199                        $value = str_replace ( "-", " ", $value);
    21482200                       
    2149                         if($format === "39" || $format === "41" || $format === "43" || $format === "44" || $format === "53")
     2201                        if($format === "37" || $format === "39" || $format === "41" || $format === "43" || $format === "44" || $format === "53")
    21502202                            $value = strtoupper($value);   
    2151                         else if($format === "40" || $format === "42" || $format === "47" || $format === "48" || $format === "54")
     2203                        else if($format === "38" || $format === "40" || $format === "42" || $format === "47" || $format === "48" || $format === "54")
    21522204                            $value = strtolower($value);
    2153                         else
     2205                        else if(!$is_member_press)
    21542206                            $value = ucwords($value);
    21552207                    }
     
    21622214                            $parsed_val .= ", ";
    21632215                    }
     2216                   
    21642217                    //Add BR tag for multi value flds
    21652218                    else if($inc > 1)       
     
    21702223                   
    21712224                    $key_val_array = true;
    2172                                        
    2173                     if($format === "5" || $format === "39" || $format === "40" || $format === "43" || $format === "45") 
     2225                   
     2226                    if($format === "5" || $format === "39" || $format === "40" || $format === "43" || $format === "45")
    21742227                        $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $value;
    2175                     else if($format === "11" || $format === "35") 
    2176                         $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key ;
    2177                     else if($format === "49")
     2228                    else if($format === "11" || $format === "35")
     2229                        $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key;
     2230                    else if($format === "49" || $format === "50")
    21782231                        $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key . ": " . $value;
    2179                     else if($format === "14" || $format === "8" || $format === "36" )
    2180                         $parsed_val .= $key;
    2181                     else if($format === "13" || $format === "44" || $format === "49" || $format === "50")
     2232                    else if($format === "13" )
    21822233                        $parsed_val .= $key . ": " . $value;
    2183                     else           
     2234                    else if($format === "14" || $format === "8" || $format === "36" )
     2235                        $parsed_val .= $key;
     2236                    else
    21842237                        $parsed_val .= $value;
    21852238                   
     
    21982251        if($numeric_idx)
    21992252        {
     2253            $is_member_press = false;
     2254               
    22002255            for($met=0; $met < sizeof($user_meta_fld); $met++)
    22012256            {
     2257                $is_member_press = false;
     2258               
    22022259                if($user_meta_fld[$met])
    22032260                {
     
    22072264                    {
    22082265                       
     2266                        //echo "Format var is $format...<BR>";
     2267                       
     2268                        //MemberPress ONLY: Pull the corresponding fld label for all "Show Label" format options
     2269                        if($format === "8" || $format === "11" || $format === "14" || $format === "35" || $format === "36")
     2270                        {
     2271                            $mepr_options = null;
     2272                           
     2273                            try
     2274                            {
     2275                                $mepr_options = MeprOptions::fetch();
     2276                                if(!is_null($mepr_options))
     2277                                {
     2278                                    foreach($mepr_options->custom_fields as $line) {
     2279                                       
     2280                                      //echo "Line Field Key: " . $line->field_key . ", DUD Fld Key: " . $meta_fld_key_name . "<BR>";
     2281                                     
     2282                                      if($line->field_key == $meta_fld_key_name) {
     2283                                        foreach($line->options as $option_key => $option_val) {
     2284                                           
     2285                                          $no_hyphens = str_replace ( "-", " ", $user_meta_fld[$met]);
     2286                                           
     2287                                          //echo "Line Option Val: " . $option_val->option_name . ", Meta Fld Val: " . $no_hyphens . "<BR>";
     2288                                           
     2289                                          if(strtoupper($option_val->option_name) === strtoupper($no_hyphens)) {
     2290                                            $value = $option_val->option_name;
     2291                                            $key = $option_val->option_name;
     2292                                            $is_member_press = true;
     2293                                          }
     2294                                        }
     2295                                      }
     2296                                    }
     2297                                   
     2298                                    //echo "<BR>";
     2299                                }
     2300                            }
     2301                            catch(Exception $e)
     2302                            {
     2303                                ;
     2304                            }
     2305                        }
     2306                       
    22092307                        //Hide Hyphens & Capitalization
    2210                         if($format === "5" || $format === "39" || $format === "40"
    2211                            || $format === "4" || $format === "41" || $format === "42"
     2308                        if($format === "5" || $format === "39" || $format === "30"
     2309                           || $format === "37" || $format === "38" || $format === "40"
     2310                           || $format === "4"  || $format === "41" || $format === "42"
    22122311                           || $format === "45" || $format === "43" | $format === "44"
    22132312                           || $format === "47" || $format === "13" || $format === "15"
    2214                            || $format === "48" || $format === "50"
    2215                            || $format === "53" || $format === "54")
     2313                           || $format === "48" || $format === "49" || $format === "50"
     2314                           || $format === "35" || $format === "36" || $format === "11"
     2315                           || $format === "8"  || $format === "53" || $format === "54")
    22162316                        {
    2217                             $listitem = str_replace ( "-", " ", $listitem);
    2218                            
    2219                             if($format === "39" || $format === "41" || $format === "43" || $format === "44")
    2220                                 $user_meta_fld[$met] = strtoupper($user_meta_fld[$met]);   
    2221                             else if($format === "40" || $format === "42" || $format === "47" || $format === "48")
    2222                                 $user_meta_fld[$met] = strtolower($user_meta_fld[$met]);   
    2223                             else
    2224                                 $user_meta_fld[$met] = ucwords($user_meta_fld[$met]);
     2317                            $value = str_replace ( "-", " ", $value);
     2318                       
     2319                            if($format === "37" || $format === "39" || $format === "41" || $format === "43" || $format === "44" || $format === "53")
     2320                                $value = strtoupper($value);   
     2321                            else if($format === "38" || $format === "40" || $format === "42" || $format === "47" || $format === "48" || $format === "54")
     2322                                $value = strtolower($value);
     2323                            else if(!$is_member_press)
     2324                                $value = ucwords($value);
    22252325                        }
    22262326                       
     
    22372337                            $format !== "13" && $format !== "14" && $format !== "15" && $format !== "53" && $format !== "54" && $inc == 1)
    22382338                            $parsed_val .= "<BR>"; 
    2239                                            
    2240                         if($format === "5" || $format === "35" || $format === "39" || $format === "40" || $format === "11"
    2241                             || $format === "43" || $format === "45" || $format === "47" )
    2242                             $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $user_meta_fld[$met];
     2339                       
     2340                        if($format === "5" || $format === "39" || $format === "40" || $format === "43" || $format === "45")
     2341                            $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $value;
     2342                        else if($format === "11" || $format === "35")
     2343                            $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key;
     2344                        else if($format === "49" || $format === "50")
     2345                            $parsed_val .= "<i class=\"fas fa-circle dud-fa-bullet\" aria-hidden=\"true\"></i>" . $key . ": " . $value;
     2346                        else if($format === "13" )
     2347                            $parsed_val .= $key . ": " . $value;
     2348                        else if($format === "14" || $format === "8" || $format === "36" )
     2349                            $parsed_val .= $key;
    22432350                        else
    2244                             $parsed_val .= $user_meta_fld[$met];
     2351                            $parsed_val .= $value;
    22452352                   
    22462353                        $inc++;
  • dynamic-user-directory/trunk/readme.txt

    r3049189 r3093386  
    66Requires at least: 3.0.1
    77Tested up to: 6.4.3
    8 Stable tag: 1.8
     8Stable tag: 1.9
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9898== Changelog ==
    9999
     100= 1.9 =
     101- Released 5/27/24
     102- Successfully tested against WordPress 6.5.3.
     103- Fixed: Several field formatting options were not working correctly.
     104- Enhancement for MemberPress users: Multiselect box and multiple or single checkbox fields will now show the original capitalization configured in MemberPress (with no hyphens) when any of the "Show Labels" format options is selected.
     105
    100106= 1.8 =
    101 - Released 3/11/23
     107- Released 3/11/24
    102108- Successfully tested against WordPress 6.4.3.
    103109
Note: See TracChangeset for help on using the changeset viewer.