groups_edit_group_settings( int $group_id, bool $enable_forum, string $status, string|bool $invite_status = false, string|bool $activity_feed_status = false, int|bool $parent_id = false, string|bool $media_status = false,  $document_status = false, string|bool $album_status = false,  $message_status = false )

Edit the base details for a group.

Description

These are the settings that appear on the Settings page of the group’s Admin section (privacy settings, "enable forum", invitation status).

Parameters

$group_id

(int) (Required) ID of the group.

$enable_forum

(bool) (Required) Whether to enable a forum for the group.

$status

(string) (Required) Group status. 'public', 'private', 'hidden'.

$invite_status

(string|bool) (Optional) Who is allowed to send invitations to the group. 'members', 'mods', or 'admins'.

Default value: false

$activity_feed_status

(string|bool) (Optional) Who is allowed to send invitations to the group. 'members', 'mods', or 'admins'.

Default value: false

$parent_id

(int|bool) (Optional) Parent group ID.

Default value: false

$media_status

(string|bool) (Optional) Who is allowed to manage media to the group. 'members', 'mods', or 'admins'.

Default value: false

$album_status

(string|bool) (Optional) Who is allowed to manage albums if media is enabled with album support. to the group. 'members', 'mods', or 'admins'.

Default value: false

Return

(bool) True on success, false on failure.

Source

File: bp-groups/bp-groups-functions.php

function groups_edit_group_settings( $group_id, $enable_forum, $status, $invite_status = false, $activity_feed_status = false, $parent_id = false, $media_status = false, $album_status = false ) {

	$group = groups_get_group( $group_id );
	$group->enable_forum = $enable_forum;

	/**
	 * Before we potentially switch the group status, if it has been changed to public
	 * from private and there are outstanding membership requests, auto-accept those requests.
	 */
	if ( 'private' == $group->status && 'public' == $status )
		groups_accept_all_pending_membership_requests( $group->id );

	// Now update the status.
	$group->status = $status;

	// Update the parent ID if necessary.
	if ( false !== $parent_id ) {
		$group->parent_id = $parent_id;
	}

	if ( !$group->save() )
		return false;

	// Set the invite status.
	if ( $invite_status )
		groups_update_groupmeta( $group->id, 'invite_status', $invite_status );

	// Set the activity feed status.
	if ( $activity_feed_status )
		groups_update_groupmeta( $group->id, 'activity_feed_status', $activity_feed_status );

	// Set the media status.
	if ( $media_status )
		groups_update_groupmeta( $group->id, 'media_status', $media_status );

	// Set the album status.
	if ( $album_status )
		groups_update_groupmeta( $group->id, 'album_status', $album_status );

	groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );

	/**
	 * Fires after the update of a groups settings.
	 *
	 * @since BuddyPress 1.0.0
	 *
	 * @param int $id ID of the group that was updated.
	 */
	do_action( 'groups_settings_updated', $group->id );

	return true;
}

Changelog

Changelog
Version Description
BuddyPress 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.