Activity::generate( $args,  $assoc_args )

Generate random activity items.


Description Description

Top ↑

OPTIONS OPTIONS

Top ↑

[–count=] : How many activity items to generate. [–count=] : How many activity items to generate.

Top ↑

default: 100 default: 100

Top ↑

[–skip-activity-comments=] : Whether to skip activity comments. Recording activity_comment items requires a resource-intensive tree rebuild. [–skip-activity-comments=] : Whether to skip activity comments. Recording activity_comment items requires a resource-intensive tree rebuild.

Top ↑

default: 1 default: 1

Top ↑

EXAMPLE EXAMPLE

$ wp bp activity generate --count=50

Source Source

File: cli/src/activity.php

	public function generate( $args, $assoc_args ) {
		$component = $this->get_random_component();
		$type      = $this->get_random_type_from_component( $component );

		if ( (bool) $assoc_args['skip-activity-comments'] && 'activity_comment' === $type ) {
			$type = 'activity_update';
		}

		$notify = WP_CLI\Utils\make_progress_bar( 'Generating activity items', $assoc_args['count'] );

		for ( $i = 0; $i < $assoc_args['count']; $i++ ) {
			$this->create(
				array(),
				array(
					'component' => $component,
					'type'      => $type,
					'content'   => $this->generate_random_text(),
					'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.