Plugin Directory

Changeset 3439281


Ignore:
Timestamp:
01/14/2026 08:30:11 AM (2 months ago)
Author:
Molongui
Message:

5.2.5 (2026-01-14)

  • Fixed: Byline linking only to the first listed author on some themes.
  • Fixed: Archived guest authors are now properly excluded from author search results.
Location:
molongui-authorship/trunk
Files:
1 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • molongui-authorship/trunk/README.txt

    r3421622 r3439281  
    253253
    254254<strong>Important</strong>: If you use a caching plugin, please clear your cache after updating any plugins.
     255
     256= 5.2.5 (2026-01-14) =
     257
     258* **Fixed**: Byline linking only to the first listed author on some themes.
     259* **Fixed**: Archived guest authors are now properly excluded from author search results.
    255260
    256261= 5.2.4 (2025-12-17) =
  • molongui-authorship/trunk/changelog.txt

    r3421622 r3439281  
    22
    33== Changelog ==
     4
     5= 5.2.5 (2026-01-14) =
     6
     7* **Fixed**: Byline linking only to the first listed author on some themes.
     8* **Fixed**: Archived guest authors are now properly excluded from author search results.
    49
    510= 5.2.4 (2025-12-17) =
  • molongui-authorship/trunk/includes/admin/admin-post.php

    r3415065 r3439281  
    690690                    LEFT JOIN {$wpdb->postmeta} pm1 ON {$wpdb->posts}.ID = pm1.post_id AND pm1.meta_key = %s
    691691                    LEFT JOIN {$wpdb->postmeta} pm2 ON {$wpdb->posts}.ID = pm2.post_id AND pm2.meta_key = %s
     692                    LEFT JOIN {$wpdb->postmeta} pm3 ON {$wpdb->posts}.ID = pm3.post_id AND pm3.meta_key = %s
    692693                    WHERE
    693694                        {$wpdb->posts}.post_status = 'publish' AND
    694695                        {$wpdb->posts}.post_type = %s AND
    695696                        {$wpdb->posts}.ID NOT IN ( $ignored_guests_placeholder ) AND
     697                        pm3.meta_id IS NULL AND
    696698                        (
    697699                            {$wpdb->posts}.post_title LIKE %s OR
     
    699701                            pm2.meta_value LIKE %s
    700702                        )
    701                 ", 'first_name', 'last_name', MOLONGUI_AUTHORSHIP_CPT, $like_keyword, $like_keyword, $like_keyword );
     703                ", 'first_name', 'last_name', '_molongui_guest_author_archived', MOLONGUI_AUTHORSHIP_CPT, $like_keyword, $like_keyword, $like_keyword );
    702704                    $found_guests = $wpdb->get_col( $sql );
    703705
  • molongui-authorship/trunk/includes/admin/author-list-table.php

    r3421622 r3439281  
    1414namespace Molongui\Authorship\Admin;
    1515
     16use Molongui\Authorship\Author;
    1617use Molongui\Authorship\Authors;
    1718use Molongui\Authorship\Common\Utils\Debug;
     
    189190                'prefetch' => array
    190191                (
    191                     'core' => array( 'post_title' ),
     192                    'core' => array( 'display_name', 'post_title' ),
    192193                    'meta' => array(),
    193194                ),
     
    206207                'id',
    207208                'name',
     209                'display_name',
    208210                'first_name',
    209211                'last_name',
     
    253255    private function filter_table_data( $table_data, $search_key, $search_in )
    254256    {
    255         $search_key = (string) $search_key;
    256 
    257         $filtered_table_data = array_values( array_filter( $table_data, function( $row ) use( $search_key, $search_in )
    258         {
    259             $get_value = static function( $row, $key )
     257        $search_key = trim( (string) $search_key );
     258        if ( $search_key === '' || empty( $table_data ) || empty( $search_in ) )
     259        {
     260            return $table_data;
     261        }
     262        $needle = strtolower( $search_key );
     263        $fields = array();
     264        foreach ( (array) $search_in as $field )
     265        {
     266            $field = (string) $field;
     267            if ( $field !== '' )
    260268            {
    261                 if ( is_object( $row ) )
    262                 {
    263                     switch ( $key )
     269                $fields[ $field ] = true;
     270            }
     271        }
     272        if ( empty( $fields ) )
     273        {
     274            return $table_data;
     275        }
     276        $fields = array_keys( $fields );
     277
     278        $filtered = array();
     279
     280        foreach ( (array) $table_data as $row )
     281        {
     282            if ( $row instanceof Author )
     283            {
     284                foreach ( $fields as $field )
     285                {
     286                    $value = '';
     287
     288                    switch ( $field )
    264289                    {
    265290                        case 'id':
    266                             return method_exists( $row, 'get_id' ) ? (string) $row->get_id() : '';
     291                            $value = (string) $row->get_id();
     292                            break;
    267293
    268294                        case 'name':
    269                             if ( method_exists( $row, 'get_display_name' ) )
    270                             {
    271                                 return (string) $row->get_display_name();
    272                             }
    273                             if ( method_exists( $row, 'get_name' ) )
    274                             {
    275                                 return (string) $row->get_name();
    276                             }
    277                             return '';
     295                        case 'display_name':
     296                            $value = (string) $row->get_display_name();
     297                            break;
     298
     299                        case 'first_name':
     300                            $value = (string) $row->get_first_name();
     301                            break;
     302
     303                        case 'last_name':
     304                            $value = (string) $row->get_last_name();
     305                            break;
    278306
    279307                        case 'email':
    280                             return method_exists( $row, 'get_email' ) ? (string) $row->get_email() : '';
    281 
    282                         case 'first_name':
    283                         case 'last_name':
    284                         case 'user_login':
    285                             return method_exists( $row, 'get_meta' ) ? (string) $row->get_meta( $key ) : '';
     308                            $value = (string) $row->get_email();
     309                            break;
    286310
    287311                        default:
    288                             return method_exists( $row, 'get_meta' ) ? (string) $row->get_meta( $key ) : '';
    289                     }
    290                 }
    291                 if ( is_array( $row ) && isset( $row[ $key ] ) )
    292                 {
    293                     $val = $row[ $key ];
     312                            $value = (string) $row->get_meta( $field );
     313                            break;
     314                    }
     315
     316                    if ( $value !== '' && strpos( strtolower( $value ), $needle ) !== false )
     317                    {
     318                        $filtered[] = $row;
     319                        break;
     320                    }
     321                }
     322
     323                continue;
     324            }
     325            if ( is_array( $row ) )
     326            {
     327                foreach ( $fields as $field )
     328                {
     329                    if ( ! isset( $row[ $field ] ) )
     330                    {
     331                        continue;
     332                    }
     333
     334                    $val = $row[ $field ];
    294335                    if ( is_array( $val ) )
    295336                    {
    296337                        $val = implode( ', ', $val );
    297338                    }
    298                     return (string) $val;
    299                 }
    300 
    301                 return '';
    302             };
    303 
    304             foreach ( $search_in as $key )
    305             {
    306                 $value = $get_value( $row, $key );
    307                 if ( $value !== '' && stripos( $value, $search_key ) !== false )
    308                 {
    309                     return true;
     339
     340                    if ( $val !== '' && strpos( strtolower( (string) $val ), $needle ) !== false )
     341                    {
     342                        $filtered[] = $row;
     343                        break;
     344                    }
    310345                }
    311346            }
    312 
    313             return false;
    314         } ) );
    315 
    316         return $filtered_table_data;
     347        }
     348
     349        return $filtered;
    317350    }
    318351    public function no_items()
  • molongui-authorship/trunk/includes/admin/post-count-updater.php

    r3421622 r3439281  
    7070    {
    7171        add_action( "wp_ajax_molongui_authorship_update_post_count", array( $this, 'handle_ajax_request' ) );
    72         add_action( 'wp_ajax_authorship_update_counters', array( $this, 'handle_ajax_request' ) );
    7372    }
    7473    public function handle_ajax_request()
  • molongui-authorship/trunk/includes/author-filters.php

    r3421622 r3439281  
    1313class Author_Filters
    1414{
    15     private $javascript = '/assets/js/byline.f4f7.min.js';
     15    private $javascript = '/assets/js/byline.e0b3.min.js';
    1616    public function __construct()
    1717    {
  • molongui-authorship/trunk/includes/author.php

    r3421622 r3439281  
    378378                $email = ( $this->is_user )
    379379                    ? (string) $this->get_core_value( 'user_email' )
    380                     : (string) $this->get_meta_value( '_molongui_guest_author_mail' );
     380                    : (string) $this->get_meta_value( self::GUEST_META_PREFIX . 'mail' );
    381381
    382382                /*!
     
    729729            return '';
    730730        }
     731
     732        $key = (string) $key;
    731733        $label = 'meta:' . $key;
    732         $is_full_user   = ( strpos( $key, 'molongui_author_' ) === 0 );
    733         $is_full_guest  = ( strpos( $key, '_molongui_guest_author_' ) === 0 );
    734         $keep_native    = ( $this->type === 'user' && in_array( $key, self::$allowed_user_meta_keys, true ) );
    735         $final_meta_key = ( $is_full_user || $is_full_guest || $keep_native  ) ? $key : $this->qualify_meta_key( $key );
     734        if ( $this->type === 'user' )
     735        {
     736            $map = $this->get_user_virtual_meta_map();
     737
     738            if ( isset( $map[$key] ) )
     739            {
     740                $core_field = (string) $map[$key];
     741
     742                return $this->get_computed_value(
     743                    $label,
     744                    function() use ( $core_field, $key )
     745                    {
     746                        $value = (string) $this->get_core_value( $core_field );
     747
     748                        /*!
     749                         * DEPRECATED
     750                         * This filter hook is scheduled for removal in version 5.4.0. Update any dependencies accordingly.
     751                         *
     752                         * @since      5.0.0
     753                         * @deprecated 5.2.0 Use "molongui_authorship/author/{$key}" instead
     754                         */
     755                        if ( has_filter( "molongui_authorship/get_author_meta_{$key}" ) && apply_filters( 'molongui_authorship/apply_filters_deprecated', true ) )
     756                        {
     757                            $value = apply_filters_deprecated(
     758                                "molongui_authorship/get_author_meta_{$key}",
     759                                array( $value, $this->id, $this->type, $this ),
     760                                '5.2.0',
     761                                "molongui_authorship/author/{$key}"
     762                            );
     763                        }
     764
     765                        return $value;
     766                    },
     767                    "molongui_authorship/author/{$key}"
     768                );
     769            }
     770        }
     771        $is_full_user   = ( strpos( $key, self::USER_META_PREFIX ) === 0 );
     772        $is_full_guest  = ( strpos( $key, self::GUEST_META_PREFIX ) === 0 );
     773        $final_meta_key = ( $is_full_user || $is_full_guest ) ? $key : $this->qualify_meta_key( $key );
    736774
    737775        return $this->get_computed_value(
     
    18631901        return in_array( $field, $guest_allowed, true ) ? $field : '';
    18641902    }
     1903    private function get_user_virtual_meta_map()
     1904    {
     1905        static $map = null;
     1906
     1907        if ( $map !== null )
     1908        {
     1909            return $map;
     1910        }
     1911
     1912        $map = array
     1913        (
     1914            'email'         => 'user_email',
     1915            'mail'          => 'user_email',
     1916            'user_email'    => 'user_email',
     1917
     1918            'website'       => 'user_url',
     1919            'web'           => 'user_url',
     1920            'user_url'      => 'user_url',
     1921
     1922            'display_name'  => 'display_name',
     1923            'name'          => 'display_name',
     1924
     1925            'slug'          => 'user_nicename',
     1926            'nicename'      => 'user_nicename',
     1927            'user_nicename' => 'user_nicename',
     1928
     1929            'user_login'    => 'user_login',
     1930            'login'         => 'user_login',
     1931        );
     1932
     1933        /*!
     1934         * FILTER HOOK
     1935         * Allows filtering the virtual meta key map for USER authors.
     1936         *
     1937         * The returned array must map requested meta keys to wp_users column names.
     1938         *
     1939         * @param array  $map    Virtual meta map.
     1940         * @param Author $author Current author instance.
     1941         * @since 5.2.5
     1942         */
     1943        $map = apply_filters( 'molongui_authorship/author/user_virtual_meta_map', $map, $this );
     1944        if ( ! is_array( $map ) )
     1945        {
     1946            $map = array();
     1947        }
     1948
     1949        return $map;
     1950    }
    18651951    private static function get_enabled_social_profile_keys()
    18661952    {
  • molongui-authorship/trunk/includes/authors.php

    r3421622 r3439281  
    288288        if ( !empty( $get_data ) || (int) $min_post_count > 0 )
    289289        {
    290             $fields = apply_filters( 'molongui_authorship/get_author_data_fields', array(
     290            $fields = apply_filters( 'molongui_authorship/get_author_data_fields', array
     291            (
    291292                'id','type','display_name','first_name','last_name','slug','email','phone','website','custom_link',
    292293                'archive_url','avatar','position','company','company_link','description','post_count','user_roles',
     
    360361                $out[] = $a->get_data();
    361362            }
     363
    362364            return $out;
    363365        }
     
    373375            );
    374376        }
     377
    375378        return $out;
    376379    }
    377380    public static function _get_authors( array $args = array() )
    378381    {
     382
    379383        $a = wp_parse_args( $args, array
    380384        (
     
    398402            'language'         => apply_filters( 'authorship/get_authors/language', '' ),
    399403        ) );
    400         $type = strtolower( $a['type'] );
    401         if ( $type !== 'users' && $type !== 'guests' )
    402         {
    403             $type = 'authors'; // both
    404         }
    405         $ord = strtoupper( $a['order'] );
     404        $type = is_string( $a['type'] ) ? strtolower( $a['type'] ) : 'authors';
     405        if ( $type !== 'authors' && $type !== 'users' && $type !== 'guests' )
     406        {
     407            $type = 'authors';
     408        }
     409        $ord = strtoupper( (string) $a['order'] );
    406410        if ( $ord !== 'ASC' && $ord !== 'DESC' )
    407411        {
    408412            $ord = 'ASC';
    409413        }
    410         $oby = strtolower( $a['orderby'] );
    411         if ( $oby === 'id' || $oby === 'ID' ) { $oby = 'id'; }
    412         if ( $oby === 'email' )               { $oby = 'mail'; }
    413         if ( $oby === 'random' )              { $oby = 'rand'; }
     414        $oby = is_string( $a['orderby'] ) ? strtolower( $a['orderby'] ) : 'name';
     415        if ( $oby === 'id' || $oby === 'ids' ) { $oby = 'id'; }
     416        if ( $oby === 'display_name' ) { $oby = 'name'; }
     417        if ( $oby === 'mail' || $oby === 'email' || $oby === 'user_email' ) { $oby = 'mail'; }
     418        if ( $oby === 'random' ) { $oby = 'rand'; }
     419        $include_users  = is_array( $a['include_users'] )  ? array_values( array_unique( array_map( 'absint', $a['include_users'] ) ) ) : array();
     420        $exclude_users  = is_array( $a['exclude_users'] )  ? array_values( array_unique( array_map( 'absint', $a['exclude_users'] ) ) ) : array();
     421        $include_guests = is_array( $a['include_guests'] ) ? array_values( array_unique( array_map( 'absint', $a['include_guests'] ) ) ) : array();
     422        $exclude_guests = is_array( $a['exclude_guests'] ) ? array_values( array_unique( array_map( 'absint', $a['exclude_guests'] ) ) ) : array();
     423        $roles = is_array( $a['roles'] ) ? array_values( array_unique( array_map( 'sanitize_key', $a['roles'] ) ) ) : Settings::enabled_user_roles();
     424        if ( empty( $roles ) )
     425        {
     426            $roles = Settings::enabled_user_roles();
     427        }
     428        $post_types = array();
     429        if ( ! empty( $a['post_types'] ) && is_array( $a['post_types'] ) )
     430        {
     431            foreach ( $a['post_types'] as $pt )
     432            {
     433                $pt = sanitize_key( (string) $pt );
     434                if ( $pt !== '' )
     435                {
     436                    $post_types[] = $pt;
     437                }
     438            }
     439        }
     440        if ( empty( $post_types ) )
     441        {
     442            $post_types = array( 'post' );
     443        }
    414444        $prefetch_core_users  = array();
    415445        $prefetch_core_guests = array();
     
    442472        if ( ! empty( $a['exclude_archived'] ) )
    443473        {
    444             $prefetch_meta_users[]  = 'molongui_author_archived';
    445             $prefetch_meta_guests[] = '_molongui_guest_author_archived';
     474            $prefetch_meta_users[]  = Author::USER_META_PREFIX  . 'archived';
     475            $prefetch_meta_guests[] = Author::GUEST_META_PREFIX . 'archived';
    446476        }
    447477        $min_post_count = (int) $a['min_post_count'];
     
    452482                foreach ( $a['post_types'] as $pt )
    453483                {
    454                     $prefetch_meta_users[]  = 'molongui_author_' . $pt . '_count';
    455                     $prefetch_meta_guests[] = '_molongui_guest_author_' . $pt . '_count';
     484                    $prefetch_meta_users[]  = Author::USER_META_PREFIX . $pt . '_count';
     485                    $prefetch_meta_guests[] = Author::GUEST_META_PREFIX . $pt . '_count';
    456486                }
    457487            }
  • molongui-authorship/trunk/includes/post.php

    r3421622 r3439281  
    788788        $last_separator = apply_filters( 'molongui_authorship/co_authors_last_separator', $last_separator, $count );
    789789
    790         /*!
    791          * DEPRECATED
    792          * This filter hooks are scheduled for removal in version 5.2.0. Update any dependencies accordingly.
    793          *
    794          * @since      4.6.19
    795          * @deprecated 5.0.0
    796          * @use        molongui_authorship/co_authors_separator
    797          *             molongui_authorship/co_authors_last_separator
    798          */
    799         if ( apply_filters( 'molongui_authorship/apply_filters_deprecated', true ) )
    800         {
    801             $separator      = apply_filters_deprecated( 'authorship/byline_separator', array( $separator, $count ), '5.0.0', 'molongui_authorship/co_authors_separator' );
    802             $last_separator = apply_filters_deprecated( 'authorship/byline_last_separator', array( $last_separator, $count ), '5.0.0', 'molongui_authorship/co_authors_last_separator' );
    803         }
    804 
    805790        return array( $separator, $last_separator );
    806791    }
  • molongui-authorship/trunk/molongui-authorship.php

    r3421622 r3439281  
    1313 * Plugin URI:        https://www.molongui.com/wordpress-plugin-post-authors
    1414 * Description:       All-in-One Authorship Solution: Seamless Author Box, Guest Authors, and Co-Authors to enhance your site's authority, credibility, engagement, and SEO.
    15  * Version:           5.2.4
     15 * Version:           5.2.5
    1616 * Requires at least: 5.2
    1717 * Tested up to:      6.9
     
    4444final class MolonguiAuthorship
    4545{
    46     const VERSION = '5.2.4';
     46    const VERSION = '5.2.5';
    4747    use Singleton;
    4848    function __construct()
     
    234234        (
    235235            MOLONGUI_AUTHORSHIP_DIR . 'dropins/',
    236             MOLONGUI_AUTHORSHIP_DIR . 'includes/helpers/',
    237             MOLONGUI_AUTHORSHIP_DIR . 'includes/hooks/',
    238236            MOLONGUI_AUTHORSHIP_DIR . 'includes/author-box.php',
    239237            MOLONGUI_AUTHORSHIP_DIR . 'includes/author-filters.php',
Note: See TracChangeset for help on using the changeset viewer.