<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][12772] trunk: Blogs: use a default "blavatar" when the blog has no site icon</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12772">12772</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12772","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-10-30 22:13:38 +0000 (Fri, 30 Oct 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Blogs: use a default "blavatar" when the blog has no site icon
So far when the Blogs component was not supporting the WordPress site icon feature or when the blog had no site icon set, we used to fallback on the Blog Administrator's avatar.
We realized this was a wrong approach, because:
- the site creator may no longer be a member of the specific site, in which case the lowest id will belong to a different (non-admin) user.
- The site admin may have changed in some other way.
- The site creator's account may have been deleted.
- Etc.
When any of these happen, you get the avatar of a random site user.
That's why just like we do for users or groups, we are now using a default blog avatar (`mysterious-blog.png`) as a fallback when the site icon for the blog is not available.
Props boonebgorges, vapvarun, johnjamesjacoby
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8179">#8179</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpblogsbpblogsfiltersphp">trunk/src/bp-blogs/bp-blogs-filters.php</a></li>
<li><a href="#trunksrcbpblogsbpblogstemplatephp">trunk/src/bp-blogs/bp-blogs-template.php</a></li>
<li><a href="#trunktestsphpunittestcasesblogstemplatephp">trunk/tests/phpunit/testcases/blogs/template.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbpcoreimagesmysteryblog50png">trunk/src/bp-core/images/mystery-blog-50.png</a></li>
<li><a href="#trunksrcbpcoreimagesmysteryblogpng">trunk/src/bp-core/images/mystery-blog.png</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpblogsbpblogsfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-blogs/bp-blogs-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-blogs/bp-blogs-filters.php 2020-10-28 13:17:03 UTC (rev 12771)
+++ trunk/src/bp-blogs/bp-blogs-filters.php 2020-10-30 22:13:38 UTC (rev 12772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,6 +137,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'site_icon_image_sizes', 'bp_blogs_register_custom_site_icon_size' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Use the mystery blog avatar for blogs.
+ *
+ * @since 7.0.0
+ *
+ * @param string $avatar Current avatar src.
+ * @param array $params Avatar params.
+ * @return string
+ */
+function bp_blogs_default_avatar( $avatar, $params ) {
+ if ( isset( $params['object'] ) && 'blog' === $params['object'] ) {
+ if ( isset( $params['type'] ) && 'thumb' === $params['type'] ) {
+ $file = 'mystery-blog-50.png';
+ } else {
+ $file = 'mystery-blog.png';
+ }
+
+ $avatar = buddypress()->plugin_url . "bp-core/images/$file";
+ }
+
+ return $avatar;
+}
+add_filter( 'bp_core_avatar_default', 'bp_blogs_default_avatar', 10, 2 );
+add_filter( 'bp_core_avatar_default_thumb', 'bp_blogs_default_avatar', 10, 2 );
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Filters the column name during blog metadata queries.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This filters 'sanitize_key', which is used during various core metadata
</span></span></pre></div>
<a id="trunksrcbpblogsbpblogstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-blogs/bp-blogs-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-blogs/bp-blogs-template.php 2020-10-28 13:17:03 UTC (rev 12771)
+++ trunk/src/bp-blogs/bp-blogs-template.php 2020-10-30 22:13:38 UTC (rev 12772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -298,11 +298,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Get a blog's avatar.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * At the moment, blog avatars are simply the user avatars of the blog
- * admin. Filter 'bp_get_blog_avatar_' . $blog_id to customize.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * At the moment, unless the blog has a site icon, the blog's avatar defaults
+ * to the /bp-core/images/mystery-blog.png image or the Blog's Admin user avatar
+ * if the `admin_user_id` argument contains the Blog's Admin user ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.4.0 Introduced `$title` argument.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.0.0 Introduced the `$blog_id`, `$admin_user_id` and `html` arguments.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 7.0.0 Introduced the Blog's default avatar {@see bp_blogs_default_avatar()}.
+ * Removed the `'bp_get_blog_avatar_' . $blog_id` filter (it was deprecated since 1.5).
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see bp_core_fetch_avatar() For a description of arguments and
</span><span class="cx" style="display: block; padding: 0 10px"> * return values.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -333,41 +336,43 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Set default values.
- $author_displayname = '';
- $admin_user_id = 0;
- $blog_id = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Set default value for the `alt` attribute.
+ $alt_attribute = __( 'Site icon for the blog', 'buddypress' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $blogs_template && isset( $args['admin_user_id'] ) && $args['admin_user_id'] ) {
- $admin_user_id = (int) $args['admin_user_id'];
- $author_displayname = bp_core_get_user_displayname( $admin_user_id );
- } else {
- $admin_user_id = $blogs_template->blog->admin_user_id;
- $author_displayname = bp_core_get_user_displayname( $blogs_template->blog->admin_user_id );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( ! $blogs_template && isset( $args['blog_id'] ) && $args['blog_id'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $blog_id = (int) $args['blog_id'];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $blog_id = bp_get_blog_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $blog_id = bp_get_blog_id();
+ $alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Parse the arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> $r = bp_parse_args( $args, array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'type' => 'full',
- 'width' => false,
- 'height' => false,
- 'class' => 'avatar',
- 'id' => false,
- 'alt' => sprintf(
- /* translators: %s: the author display name */
- __( 'Profile picture of site author %s', 'buddypress' ),
- esc_attr( $author_displayname )
- ),
- 'no_grav' => false,
- 'html' => true,
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'item_id' => $blog_id,
+ 'avatar_dir' => 'blog-avatars',
+ 'object' => 'blog',
+ 'type' => 'full',
+ 'width' => false,
+ 'height' => false,
+ 'class' => 'avatar',
+ 'id' => false,
+ 'alt' => $alt_attribute,
+ 'no_grav' => false,
+ 'html' => true,
+ ), 'blog_avatar' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * If the `admin_user_id` was provided, make the Blog avatar
+ * defaults to the Blog's Admin user one.
+ */
+ if ( isset( $r['admin_user_id'] ) && $r['admin_user_id'] ) {
+ $r['item_id'] = (int) $r['admin_user_id'];
+ $r['avatar_dir'] = 'avatars';
+ $r['object'] = 'user';
+ } elseif ( ! $r['no_grav'] ) {
+ $r['no_grav'] = true;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Use site icon if available.
</span><span class="cx" style="display: block; padding: 0 10px"> $avatar = '';
</span><span class="cx" style="display: block; padding: 0 10px"> if ( bp_is_active( 'blogs', 'site-icon' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -420,12 +425,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $size = (int) $r['width'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $alt_attribute = __( 'Site icon for the blog', 'buddypress' );
- if ( $blogs_template ) {
- /* translators: %s is the placeholder for the name of the blog */
- $alt_attribute = sprintf( __( 'Site icon for %s', 'buddypress' ), bp_get_blog_name() );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $avatar = sprintf( '<img src="%1$s" class="%2$s" width="%3$s" height="%3$s" alt="%4$s" />',
</span><span class="cx" style="display: block; padding: 0 10px"> esc_url( $site_icon ),
</span><span class="cx" style="display: block; padding: 0 10px"> esc_attr( "{$r['class']} avatar-{$size}" ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,34 +434,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Fallback to user ID avatar.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Fallback to Default blog avatar.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( '' === $avatar ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $avatar = bp_core_fetch_avatar( array(
- 'item_id' => $admin_user_id,
- // 'avatar_dir' => 'blog-avatars',
- // 'object' => 'blog',
- 'type' => $r['type'],
- 'alt' => $r['alt'],
- 'css_id' => $r['id'],
- 'class' => $r['class'],
- 'width' => $r['width'],
- 'height' => $r['height'],
- 'no_grav' => $r['no_grav'],
- 'html' => $r['html'],
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $avatar = bp_core_fetch_avatar( $r );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * In future BuddyPress versions you will be able to set the avatar for a blog.
- * Right now you can use a filter with the ID of the blog to change it if you wish.
- * By default it will return the avatar for the primary blog admin.
- *
- * This filter is deprecated as of BuddyPress 1.5 and may be removed in a future version.
- * Use the 'bp_get_blog_avatar' filter instead.
- */
- $avatar = apply_filters( 'bp_get_blog_avatar_' . $blog_id, $avatar );
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Filters a blog's avatar.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.5.0
</span></span></pre></div>
<a id="trunksrcbpcoreimagesmysteryblog50png"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-core/images/mystery-blog-50.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/src/bp-core/images/mystery-blog-50.png
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/src/bp-core/images/mystery-blog-50.png 2020-10-28 13:17:03 UTC (rev 12771)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/src/bp-core/images/mystery-blog-50.png 2020-10-30 22:13:38 UTC (rev 12772)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/bp-core/images/mystery-blog-50.png
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+image/png
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcbpcoreimagesmysteryblogpng"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-core/images/mystery-blog.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/src/bp-core/images/mystery-blog.png
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/src/bp-core/images/mystery-blog.png 2020-10-28 13:17:03 UTC (rev 12771)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/src/bp-core/images/mystery-blog.png 2020-10-30 22:13:38 UTC (rev 12772)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/bp-core/images/mystery-blog.png
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+image/png
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestcasesblogstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/testcases/blogs/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/testcases/blogs/template.php 2020-10-28 13:17:03 UTC (rev 12771)
+++ trunk/tests/phpunit/testcases/blogs/template.php 2020-10-30 22:13:38 UTC (rev 12772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -397,14 +397,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $blogs_template = $reset_blogs_template;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected = bp_core_fetch_avatar(
+ array(
+ 'type' => 'full',
+ 'item_id' => $u,
+ 'alt' => 'test',
+ 'no_grav' => true,
+ 'class' => 'avatar',
+ )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertTrue( $avatar === bp_core_fetch_avatar( array(
- 'type' => 'full',
- 'item_id' => $u,
- 'alt' => 'test',
- 'no_grav' => true,
- 'class' => 'avatar',
- ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertTrue( $avatar === $expected );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -444,6 +447,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( false !== strpos( $avatar, BP_TESTS_DIR . 'assets/upside-down.jpg' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @group avatar
+ * @group BP_Blogs_Template
+ * @group bp_get_blog_avatar
+ */
+ public function test_bp_get_blog_default_avatar() {
+ if ( ! is_multisite() ) {
+ $this->markTestSkipped();
+ }
+
+ global $blogs_template;
+ $reset_blogs_template = $blogs_template;
+ $blogs_template = null;
+
+ $u = self::factory()->user->create();
+ $b = self::factory()->blog->create( array(
+ 'title' => 'The Foo Bar Blog',
+ 'user_id' => $u,
+ ) );
+
+ $avatar = bp_get_blog_avatar(
+ array(
+ 'type' => 'thumb',
+ 'blog_id' => $b,
+ 'html' => false,
+ )
+ );
+
+ $blogs_template = $reset_blogs_template;
+ $expected = buddypress()->plugin_url . "bp-core/images/mystery-blog-50.png";
+
+ $this->assertTrue( $avatar === $expected );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function filter_blog_avatar() {
</span><span class="cx" style="display: block; padding: 0 10px"> return BP_TESTS_DIR . 'assets/upside-down.jpg';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>