Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 6 years ago

#7244 closed feature request (fixed)

Add functions bp_get_group_avatar_url() and bp_get_group_cover_url()

Reported by: mifr45's profile mifr45 Owned by: boonebgorges's profile boonebgorges
Milestone: 5.0.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: good-first-bug has-patch
Cc:

Description

Function bp_get_group_avatar_url()

<?php
function bp_get_group_avatar_url($group_id = null){
                if(!$group_id){
                        $group_id = bp_get_group_id();
                        
                }
                return bp_core_fetch_avatar(array('object' => 'group','item_id' => $group_id,'html'=>false));
        }
?>

Function bp_get_group_cover_url()

<?php
function bp_get_group_cover_url($group_id = null){
                if(!$group_id){
                        $group_id = bp_get_group_id();
                        
                }
                return bp_attachments_get_attachment('url', array('object_dir' => 'groups','item_id' => $group_id));
        }
?>

Attachments (1)

7244.patch (1.9 KB) - added by truchot 6 years ago.

Download all attachments as: .zip

Change History (9)

#1 follow-up: @DJPaul
8 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 2.7
  • Owner set to DJPaul
  • Status changed from new to assigned

Hi @mifr45

Thank you for your first contribution to BuddyPress. The functions you suggest are good suggestions, especially for the cover image.

I'll get these in for BuddyPress 2.7 unless someone beats me to it.

#2 in reply to: ↑ 1 @mifr45
8 years ago

@DJPaul, thanks for review!
I think there can be a function that outputs URL to the HTML:

<?php
function bp_group_cover_url(){
echo bp_get_group_cover_url();
}
?>

#3 @DJPaul
8 years ago

  • Owner DJPaul deleted

Relatively simple patch if anyone new wants to have a go at this.

#4 @mercime
8 years ago

  • Milestone changed from 2.7 to Future Release

#5 @slaFFik
8 years ago

  • Version 2.6.3 deleted

#6 @truchot
6 years ago

  • Keywords has-patch added; needs-patch removed

Here's my suggestion to get URLs for the group's cover or avatar.

@truchot
6 years ago

#7 @imath
6 years ago

  • Milestone changed from Awaiting Contributions to 5.0.0

Welcome @truchot !!

Thanks a lot for this first patch
Let's try to have this in for 5.0.0.

Last edited 6 years ago by imath (previous) (diff)

#8 @boonebgorges
6 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from assigned to closed

In 12362:

Introduce functions to fetch group avatar and cover image URLs.

Props truchot.
Fixes #7244.

Note: See TracTickets for help on using tickets.