Changeset 11256 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
- Timestamp:
- 09/24/2021 06:47:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
r10926 r11256 627 627 628 628 /** 629 * Get the bio of a user, either from profiles.wordpress.org or usermeta. 630 * 631 * This relies on the availability of the `bpmain_bp_xprofile_data` table, so for local environments 632 * it falls back on values in `usermeta`. 633 * 634 * @param WP_User $user 629 * Get the bio of a user, first trying usermeta and then profiles.wordpress.org. 630 * 631 * The `usermeta` bio (description) field will be pulled. If there is no bio, profiles.wordpress.org is tried. 632 * The bio at profiles.wordpress.org relies on the availability of the `bpmain_bp_xprofile_data` table. 633 * For local environments the bio will only pull from `usermeta`. 634 * 635 * @param WP_User $user The user to retrieve a bio for. 635 636 * 636 637 * @return string … … 639 640 global $wpdb; 640 641 641 $bio = ''; 642 643 if ( 'local' !== wp_get_environment_type() ) { 642 // Retrieve bio from user data. 643 $bio = $user->description; 644 645 // If bio is empty, retrieve from .org. 646 if ( ! $bio && 'local' !== wp_get_environment_type() ) { 644 647 $xprofile_field_id = 3; 645 648 … … 656 659 657 660 $bio = $wpdb->get_var( $sql ) ?: ''; // phpcs:ignore WordPress.DB.PreparedSQL -- prepare called above. 658 }659 660 if ( ! $bio ) {661 $bio = $user->description;662 661 } 663 662 … … 854 853 } 855 854 add_filter( 'syntaxhighlighter_htmlresult', 'wporg_learn_fix_code_entity_encoding', 20 ); 855 856 /** 857 * Add fallback image to Jetpack when no featured image exists. 858 * 859 * @param string $default_image The default image URL. 860 * 861 * @return string Image URL. 862 */ 863 function wporg_learn_return_default_image( $default_image ) { 864 return 'https://s.w.org/images/learn-thumbnail-fallback.jpg'; 865 } 866 add_action( 'jetpack_open_graph_image_default', 'wporg_learn_return_default_image', 15, 1 );
Note: See TracChangeset
for help on using the changeset viewer.