Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 7 years ago

#5766 closed enhancement (maybelater)

groups_get_groups does not populate_extras

Reported by: shanebp's profile shanebp Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: Core Keywords: needs-patch, trac-tidy-2018
Cc: shane@…

Description

Version 2.0.1

This function should return data that includes fields re group admins & group mods...

function test_group_data() {

	$user_id = get_current_user_id();
	
	$args = array( 
		'user_id'           => $user_id,
		'populate_extras'   => true,
		 );
	
	$groups = groups_get_groups( $args );
	
	var_dump( $groups ); 
     
}

This is the output of one of the returned groups:

[0]=> object(stdClass)#1426 (15) { 
["id"]=> string(3) "273" 
["creator_id"]=> string(1) "1" 
["name"]=> string(35) "Test Group" 
["slug"]=> string(35) "test-group" 
["description"]=> string(72) "a test group" 
["status"]=> string(6) "public" 
["enable_forum"]=> string(1) "0" 
["date_created"]=> string(19) "2014-03-20 20:37:47" 
["parent_id"]=> string(1) "0" 
["total_member_count"]=> string(2) "18" 
["last_activity"]=> string(19) "2014-07-18 16:44:04" 
["is_member"]=> string(1) "1" 
["is_invited"]=> string(1) "0" 
["is_pending"]=> string(1) "0" 
["is_banned"]=> bool(false) }


As you can see, there are no fields re group admins or mods.
It seems that 'populate_extras' is being ignored... ?

I also tried...

groups_get_user_groups( $user_id );

... the output of which includes fields for admins & mods but the fields are always NULL

Change History (4)

#1 @boonebgorges
11 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

'populate_extras' is working as intended. It's just that it means something different in the case of BP_Groups_Group::get() from what it means in the case of BP_Groups_Group::__construct(). For get(), it calls get_group_extras(), which does *not* fetch admins or mods info. For BP_Groups_Group, it calls populate(), which *does*.

In the future, it would be nice to make these two act in an identical way (ideally by using the same underlying 'populate_extras' method). But since this is not a regression, and since comprehensive unit tests will be required first, I'm going to put this in Future Release pending a patch.

#2 @shanebp
11 years ago

Thanks for the explanation. It would be very handy to have them act the same.

#3 @DJPaul
7 years ago

  • Keywords trac-tidy-2018 added

We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.

Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.

If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.

For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/

#4 @DJPaul
7 years ago

  • Milestone Awaiting Contributions deleted
  • Resolution set to maybelater
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.