Group_Invite::generate( $args,  $assoc_args )

Generate random group invitations.


Description Description

Top ↑

OPTIONS OPTIONS

Top ↑

[–count=] : How many groups invitations to generate. [–count=] : How many groups invitations to generate.

Top ↑

default: 100 default: 100

Top ↑

EXAMPLE EXAMPLE

$ wp bp group invite generate --count=50

Source Source

File: cli/src/group-invite.php

	public function generate( $args, $assoc_args ) {
		$notify = WP_CLI\Utils\make_progress_bar( 'Generating random group invitations', $assoc_args['count'] );

		for ( $i = 0; $i < $assoc_args['count']; $i++ ) {

			$random_group = \BP_Groups_Group::get_random( 1, 1 );
			$this->create(
				array(),
				array(
					'user-id'    => $this->get_random_user_id(),
					'group-id'   => $random_group['groups'][0]->slug,
					'inviter-id' => $this->get_random_user_id(),
					'silent',
				)
			);

			$notify->tick();
		}

		$notify->finish();
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.