Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/22/2016 12:35:27 AM (8 years ago)
Author:
r-a-y
Message:

Blogs: Use WordPress' Site Icons as blog avatars.

If the current install is using WordPress 4.3+, we'll now use WordPress'
Site Icon as the site avatar in the Sites Directory:
https://codex.wordpress.org/Creating_a_Favicon#WordPress_Version_4.3_or_later

If no site icon is available, we'll fallback to the site owner's user
avatar as before. Under the hood, we are mirroring the site icon URLs to
blogmeta whenever a site icon is updated or deleted.

Devs can disable this functionality with the following filter:
add_filter( 'bp_is_blogs_site-icon_active', '__return_false' );

Fixes #6544.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-filters.php

    r10825 r11150  
    122122add_filter( 'bp_activity_post_pre_publish', 'bp_blogs_post_pre_publish', 10, 4 );
    123123add_filter( 'bp_activity_post_pre_comment', 'bp_blogs_post_pre_publish', 10, 4 );
     124
     125/**
     126 * Registers our custom thumb size with WP's Site Icon feature.
     127 *
     128 * @since 2.7.0
     129 *
     130 * @param  array $sizes Current array of custom site icon sizes.
     131 * @return array
     132 */
     133function bp_blogs_register_custom_site_icon_size( $sizes ) {
     134    $sizes[] = bp_core_avatar_thumb_width();
     135    return $sizes;
     136}
     137add_filter( 'site_icon_image_sizes', 'bp_blogs_register_custom_site_icon_size' );
Note: See TracChangeset for help on using the changeset viewer.