Skip to:
Content

BuddyPress.org

Opened 7 months ago

Closed 7 months ago

Last modified 5 months ago

#8150 closed defect (bug) (fixed)

Getting the blog avatar should be possible outside a blogs loop

Reported by: imath Owned by: imath
Milestone: 6.0.0 Priority: normal
Severity: normal Version: 2.4.0
Component: Blogs Keywords: has-patch commit
Cc:

Description (last modified by imath)

Testing the new Blog REST API Endpoints, I've noticed the prepare_item_for_response() method was missing the blog avatar.

Looking at the Blogs component, I've then noticed the bp_get_blog_avatar() function was requiring the $blogs_template global to be set to fetch the blog avatar, which makes it unusable by the BP REST API.

The attached patch makes it possible to get the blog avatar outside the Blogs loop.

Attachments (1)

8150.patch (8.9 KB) - added by imath 7 months ago.

Download all attachments as: .zip

Change History (11)

@imath
7 months ago

#1 @imath
7 months ago

  • Description modified (diff)

#2 @espellcaste
7 months ago

This is not the only Blog function that is attached to the blogs_template. I didn't add this because of this:

At the moment, blog avatars are simply the user avatars of the blog.

But I think it is an important change. :)

#3 @imath
7 months ago

Thanks for your feedback @espellcaste

It's a very good point about other functions. I'll also look at it.

This ticket was mentioned in Slack in #buddypress by espellcaste. View the logs.


7 months ago

#5 @espellcaste
7 months ago

@imath Just to confirm, did we decide to merge this one and update the other functions attachment from blogs_template?

#6 @imath
7 months ago

Just this one for 6.0.0 😊

#7 @espellcaste
7 months ago

k! This patch looks good! :)

#8 @imath
7 months ago

  • Keywords commit added

Nice, thanks for your feedback let's have it in!

#9 @imath
7 months ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12496:

Make it possible to fetch a blog's avatar outside of the blogs loop

Passing 2 new parameters ($blog_id & $admin_user_id) to the bp_get_blog_avatar() function will return the corresponding blog's avatar without the need to run a blogs loop.

Props espellcaste

Fixes #8150

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


5 months ago

Note: See TracTickets for help on using tickets.