Messages::star( $args,  $assoc_args )

Star a message.


Description Description

Top ↑

OPTIONS OPTIONS

: Message ID to star.
–user-id= : User that is starring the message. Accepts either a user_login or a numeric ID.
## EXAMPLE
$ wp bp message star 3543 –user-id=user_login Success: Message was successfully starred.


Source Source

File: cli/src/messages.php

	public function star( $args, $assoc_args ) {
		$user    = $this->get_user_id_from_identifier( $assoc_args['user-id'] );
		$user_id = $user->ID;
		$msg_id  = (int) $args[0];

		if ( bp_messages_is_message_starred( $msg_id, $user_id ) ) {
			WP_CLI::error( 'The message is already starred.' );
		}

		$star_args = array(
			'action'     => 'star',
			'message_id' => $msg_id,
			'user_id'    => $user_id,
		);

		if ( bp_messages_star_set_action( $star_args ) ) {
			WP_CLI::success( 'Message was successfully starred.' );
		} else {
			WP_CLI::error( 'Message was not starred.' );
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

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