Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Update Group name with Gravity Forms

@hept27

Participant

Ask and ye shall receive. I figured it out, though I’m sure its not the cleanest solution:

I created this function from the original “groups_edit_base_group_details” function

	function bg_new_groups_edit_base_group_details( $group_id, $group_name, $group_desc, $notify_members ) {
			global $bp;

			if ( empty( $group_name ) || empty( $group_desc ) )
				return false;

			$group              = new BP_Groups_Group( $group_id );
			$group->name        = $group_name;
			$group->description = $group_desc;

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

			if ( $notify_members ) {
				groups_notification_group_updated( $group_id, $group_id, false );
			}

			do_action( 'groups_details_updated', $group_id, $group_id, false );

			return true;
		}

Then I put the following code in a gravity forms gform_after_submission action:

				$group_id = 2;
				$group_name = 'New NEw TEST';
				$group_desc = 'testing description';
				bg_new_groups_edit_base_group_details($group_id, $group_name, $group_desc, false); 

This is the proof of concept the finished product will look a little different but function the same.

Skip to toolbar