Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 7 years ago

#7244 closed feature request (fixed)

Add functions bp_get_group_avatar_url() and bp_get_group_cover_url()

Reported by: mifr45 Owned by: boonebgorges
Priority: normal Milestone: 5.0.0
Component: Groups Version:
Severity: normal 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 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 follow-up: @DJPaul
10 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone Awaiting Review2.7
  • Owner set to DJPaul
  • Status newassigned

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
10 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
10 years ago

  • Owner DJPaul removed

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

#4 @mercime
10 years ago

  • Milestone 2.7Future Release

#5 @slaFFik
10 years ago

  • Version 2.6.3

#6 @truchot
7 years ago

  • Keywords has-patch added; needs-patch removed

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

@truchot
7 years ago

#7 @imath
7 years ago

  • Milestone Awaiting Contributions5.0.0

Welcome @truchot !!

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

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

#8 @boonebgorges
7 years ago

  • Owner set to boonebgorges
  • Resolutionfixed
  • Status assignedclosed

In 12362:

Introduce functions to fetch group avatar and cover image URLs.

Props truchot.
Fixes #7244.

Note: See TracTickets for help on using tickets.