Group_Invite::generate( $args, $assoc_args )
Generate random group invitations.
Contents
Description Description
OPTIONS OPTIONS
[–count=] : How many groups invitations to generate. [–count=] : How many groups invitations to generate.
default: 100 default: 100
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(); }
Expand full source code Collapse full source code View on Trac