Changeset 3439281
- Timestamp:
- 01/14/2026 08:30:11 AM (2 months ago)
- Location:
- molongui-authorship/trunk
- Files:
-
- 1 added
- 1 deleted
- 10 edited
-
README.txt (modified) (1 diff)
-
assets/js/byline.e0b3.min.js (added)
-
assets/js/byline.f4f7.min.js (deleted)
-
changelog.txt (modified) (1 diff)
-
includes/admin/admin-post.php (modified) (2 diffs)
-
includes/admin/author-list-table.php (modified) (4 diffs)
-
includes/admin/post-count-updater.php (modified) (1 diff)
-
includes/author-filters.php (modified) (1 diff)
-
includes/author.php (modified) (3 diffs)
-
includes/authors.php (modified) (6 diffs)
-
includes/post.php (modified) (1 diff)
-
molongui-authorship.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molongui-authorship/trunk/README.txt
r3421622 r3439281 253 253 254 254 <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. 255 260 256 261 = 5.2.4 (2025-12-17) = -
molongui-authorship/trunk/changelog.txt
r3421622 r3439281 2 2 3 3 == 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. 4 9 5 10 = 5.2.4 (2025-12-17) = -
molongui-authorship/trunk/includes/admin/admin-post.php
r3415065 r3439281 690 690 LEFT JOIN {$wpdb->postmeta} pm1 ON {$wpdb->posts}.ID = pm1.post_id AND pm1.meta_key = %s 691 691 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 692 693 WHERE 693 694 {$wpdb->posts}.post_status = 'publish' AND 694 695 {$wpdb->posts}.post_type = %s AND 695 696 {$wpdb->posts}.ID NOT IN ( $ignored_guests_placeholder ) AND 697 pm3.meta_id IS NULL AND 696 698 ( 697 699 {$wpdb->posts}.post_title LIKE %s OR … … 699 701 pm2.meta_value LIKE %s 700 702 ) 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 ); 702 704 $found_guests = $wpdb->get_col( $sql ); 703 705 -
molongui-authorship/trunk/includes/admin/author-list-table.php
r3421622 r3439281 14 14 namespace Molongui\Authorship\Admin; 15 15 16 use Molongui\Authorship\Author; 16 17 use Molongui\Authorship\Authors; 17 18 use Molongui\Authorship\Common\Utils\Debug; … … 189 190 'prefetch' => array 190 191 ( 191 'core' => array( ' post_title' ),192 'core' => array( 'display_name', 'post_title' ), 192 193 'meta' => array(), 193 194 ), … … 206 207 'id', 207 208 'name', 209 'display_name', 208 210 'first_name', 209 211 'last_name', … … 253 255 private function filter_table_data( $table_data, $search_key, $search_in ) 254 256 { 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 !== '' ) 260 268 { 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 ) 264 289 { 265 290 case 'id': 266 return method_exists( $row, 'get_id' ) ? (string) $row->get_id() : ''; 291 $value = (string) $row->get_id(); 292 break; 267 293 268 294 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; 278 306 279 307 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; 286 310 287 311 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 ]; 294 335 if ( is_array( $val ) ) 295 336 { 296 337 $val = implode( ', ', $val ); 297 338 } 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 } 310 345 } 311 346 } 312 313 return false; 314 } ) ); 315 316 return $filtered_table_data; 347 } 348 349 return $filtered; 317 350 } 318 351 public function no_items() -
molongui-authorship/trunk/includes/admin/post-count-updater.php
r3421622 r3439281 70 70 { 71 71 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' ) );73 72 } 74 73 public function handle_ajax_request() -
molongui-authorship/trunk/includes/author-filters.php
r3421622 r3439281 13 13 class Author_Filters 14 14 { 15 private $javascript = '/assets/js/byline. f4f7.min.js';15 private $javascript = '/assets/js/byline.e0b3.min.js'; 16 16 public function __construct() 17 17 { -
molongui-authorship/trunk/includes/author.php
r3421622 r3439281 378 378 $email = ( $this->is_user ) 379 379 ? (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' ); 381 381 382 382 /*! … … 729 729 return ''; 730 730 } 731 732 $key = (string) $key; 731 733 $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 ); 736 774 737 775 return $this->get_computed_value( … … 1863 1901 return in_array( $field, $guest_allowed, true ) ? $field : ''; 1864 1902 } 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 } 1865 1951 private static function get_enabled_social_profile_keys() 1866 1952 { -
molongui-authorship/trunk/includes/authors.php
r3421622 r3439281 288 288 if ( !empty( $get_data ) || (int) $min_post_count > 0 ) 289 289 { 290 $fields = apply_filters( 'molongui_authorship/get_author_data_fields', array( 290 $fields = apply_filters( 'molongui_authorship/get_author_data_fields', array 291 ( 291 292 'id','type','display_name','first_name','last_name','slug','email','phone','website','custom_link', 292 293 'archive_url','avatar','position','company','company_link','description','post_count','user_roles', … … 360 361 $out[] = $a->get_data(); 361 362 } 363 362 364 return $out; 363 365 } … … 373 375 ); 374 376 } 377 375 378 return $out; 376 379 } 377 380 public static function _get_authors( array $args = array() ) 378 381 { 382 379 383 $a = wp_parse_args( $args, array 380 384 ( … … 398 402 'language' => apply_filters( 'authorship/get_authors/language', '' ), 399 403 ) ); 400 $type = strtolower( $a['type'] );401 if ( $type !== ' users' && $type !== 'guests' )402 { 403 $type = 'authors'; // both404 } 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'] ); 406 410 if ( $ord !== 'ASC' && $ord !== 'DESC' ) 407 411 { 408 412 $ord = 'ASC'; 409 413 } 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 } 414 444 $prefetch_core_users = array(); 415 445 $prefetch_core_guests = array(); … … 442 472 if ( ! empty( $a['exclude_archived'] ) ) 443 473 { 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'; 446 476 } 447 477 $min_post_count = (int) $a['min_post_count']; … … 452 482 foreach ( $a['post_types'] as $pt ) 453 483 { 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'; 456 486 } 457 487 } -
molongui-authorship/trunk/includes/post.php
r3421622 r3439281 788 788 $last_separator = apply_filters( 'molongui_authorship/co_authors_last_separator', $last_separator, $count ); 789 789 790 /*!791 * DEPRECATED792 * This filter hooks are scheduled for removal in version 5.2.0. Update any dependencies accordingly.793 *794 * @since 4.6.19795 * @deprecated 5.0.0796 * @use molongui_authorship/co_authors_separator797 * molongui_authorship/co_authors_last_separator798 */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 805 790 return array( $separator, $last_separator ); 806 791 } -
molongui-authorship/trunk/molongui-authorship.php
r3421622 r3439281 13 13 * Plugin URI: https://www.molongui.com/wordpress-plugin-post-authors 14 14 * 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. 415 * Version: 5.2.5 16 16 * Requires at least: 5.2 17 17 * Tested up to: 6.9 … … 44 44 final class MolonguiAuthorship 45 45 { 46 const VERSION = '5.2. 4';46 const VERSION = '5.2.5'; 47 47 use Singleton; 48 48 function __construct() … … 234 234 ( 235 235 MOLONGUI_AUTHORSHIP_DIR . 'dropins/', 236 MOLONGUI_AUTHORSHIP_DIR . 'includes/helpers/',237 MOLONGUI_AUTHORSHIP_DIR . 'includes/hooks/',238 236 MOLONGUI_AUTHORSHIP_DIR . 'includes/author-box.php', 239 237 MOLONGUI_AUTHORSHIP_DIR . 'includes/author-filters.php',
Note: See TracChangeset
for help on using the changeset viewer.