Plugin Directory

Changeset 3131189


Ignore:
Timestamp:
08/05/2024 05:08:02 PM (20 months ago)
Author:
Sarah_Dev
Message:

2.0

  • Released 8/5/24
  • Successfully tested against WordPress 6.6.1
  • Fixed: Corrected bug where the plugin settings page could not be saved due to some bad data in the local WP database.
  • Fixed: Corrected code that was producing the PHP warning message: 'Warning: Undefined array key "dud_instance_name" in .../public_html/wp-content/plugins/dynamic-user-directory/includes/core.php on line 1919'
  • Fixed: Corrected bug that kept users from being shown in directory if the last name field began with a space
  • Enhancement: For MemberPress users, the "Hide Hyphens" formatting option will automatically show the option name instead of the option value (which does not preserve the original capitalization)
Location:
dynamic-user-directory/trunk
Files:
4 edited

Legend:

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

    r3093386 r3131189  
    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.9
     5* Version: 2.0
    66* Author: Sarah Giles
    77* Author URI: http://sgcustomwebsolutions.com
  • dynamic-user-directory/trunk/includes/admin.php

    r3093386 r3131189  
    31253125        $user_meta_key_list = array();
    31263126       
    3127         $results = $wpdb->get_results("SELECT user_id FROM " . DUD_WPDB_PREFIX . "usermeta ORDER BY RAND() LIMIT 300");
     3127        $results = $wpdb->get_results("SELECT user_id FROM " . DUD_WPDB_PREFIX . "usermeta ORDER BY RAND() LIMIT 200");
    31283128       
    31293129        if($results)
     
    31363136                               
    31373137            foreach ($results as $result)
    3138             {       
    3139                 $all_meta_for_user = array_map( function( $a ){ return $a[0]; }, get_user_meta( $result->user_id ) );
     3138            {
     3139                $meta_vals = get_user_meta( $result->user_id );
     3140               
     3141                if($meta_vals == false || empty($meta_vals)) continue;
     3142               
     3143                $all_meta_for_user = array_map( function( $a ){ return $a[0]; }, $meta_vals );
    31403144                           
    31413145                foreach ($all_meta_for_user as $key => $value)
  • dynamic-user-directory/trunk/includes/core.php

    r3093386 r3131189  
    10211021            $user_id = $uid->user_id;
    10221022            $user_last_name = get_user_meta($user_id, 'last_name', true);
     1023            $user_last_name = ltrim($user_last_name);
    10231024        }
    10241025        else
     
    10261027            $user_id = $uid->ID;
    10271028            $user_last_name = $uid->display_name;
     1029            $user_last_name = ltrim($user_last_name);
    10281030        }
    10291031       
     
    19151917    $ud_display_listings = !empty($dud_options['ud_display_listings']) ? $dud_options['ud_display_listings'] : "";
    19161918    $inc = 1;
    1917        
    1918 
    1919     if("dev-directory" === $dud_options['dud_instance_name'])
    1920     {
    1921         echo "<BR><BR>In format meta val...<BR>";
    1922     }
    1923    
     1919           
    19241920    //*** Image ***********************************************
    19251921    if(!is_array($user_meta_fld) && $format === "34")
     
    20021998    else if(!is_array($user_meta_fld) && ($format === "30" || $format === "37" || $format === "38"))
    20031999    {
    2004         $user_meta_fld = str_replace ( "-", " ", $user_meta_fld);
    2005        
    2006         if($format === "30") //first letter in caps
    2007             return ucwords($user_meta_fld);
    2008         else if ($format === "37") //all caps
    2009             return strtoupper($user_meta_fld); 
    2010         else if ($format === "38") //all lower case
    2011             return strtolower($user_meta_fld); 
     2000        $mepr_options = null;
     2001        $is_member_press = false;
     2002                       
     2003        try
     2004        {
     2005            $mepr_options = MeprOptions::fetch();
     2006            if(!is_null($mepr_options))
     2007            {
     2008                foreach($mepr_options->custom_fields as $line) {
     2009                   
     2010                  //echo "Line Field Key: " . $line->field_key . ", DUD Fld Key: " . $meta_fld_key_name . "<BR>";
     2011                 
     2012                  if($line->field_key == $meta_fld_key_name) {
     2013                    foreach($line->options as $option_key => $option_val) {
     2014                       
     2015                      $no_hyphens = str_replace ( "-", " ", $user_meta_fld);
     2016                       
     2017                      //echo "Line Option Val: " . $option_val->option_name . ", Meta Fld Val: " . $no_hyphens . "<BR>";
     2018                       
     2019                      if(strtoupper($option_val->option_name) === strtoupper($no_hyphens)) {
     2020                        $value = $option_val->option_name;
     2021                        return $value;
     2022                      }
     2023                    }
     2024                  }
     2025                }
     2026               
     2027                //echo "<BR>";
     2028            }
     2029            else
     2030            {
     2031                $user_meta_fld = str_replace ( "-", " ", $user_meta_fld);
     2032       
     2033                if($format === "30") //first letter in caps
     2034                    return ucwords($user_meta_fld);
     2035                else if ($format === "37") //all caps
     2036                    return strtoupper($user_meta_fld); 
     2037                else if ($format === "38") //all lower case
     2038                    return strtolower($user_meta_fld); 
     2039            }
     2040           
     2041        }
     2042        catch(Exception $e)
     2043        {
     2044            ;
     2045        }
     2046       
     2047        return $user_meta_fld;
    20122048    }
    20132049   
  • dynamic-user-directory/trunk/readme.txt

    r3093387 r3131189  
    9898== Changelog ==
    9999
     100= 2.0 =
     101- Released 8/5/24
     102- Successfully tested against WordPress 6.6.1
     103- Fixed: Corrected bug where the plugin settings page could not be saved due to some bad data in the local WP database.
     104- Fixed: Corrected code that was producing the PHP warning message: 'Warning: Undefined array key "dud_instance_name" in .../public_html/wp-content/plugins/dynamic-user-directory/includes/core.php on line 1919'
     105- Fixed: Corrected bug that kept users from being shown in directory if the last name field began with a space
     106- Enhancement: For MemberPress users, the "Hide Hyphens" formatting option will automatically show the option name instead of the option value (which does not preserve the original capitalization)
     107
    100108= 1.9 =
    101109- Released 5/27/24
Note: See TracChangeset for help on using the changeset viewer.