Messages::star_thread( $args, $assoc_args )
Star a thread.
Description Description
OPTIONS OPTIONS
–user-id=
## EXAMPLE
$ wp bp message star-thread 212 –user-id=another_user_login Success: Thread was successfully starred.
Source Source
File: cli/src/messages.php
public function star_thread( $args, $assoc_args ) { $user = $this->get_user_id_from_identifier( $assoc_args['user-id'] ); $thread_id = (int) $args[0]; // Check if it is a valid thread. if ( ! messages_is_valid_thread( $thread_id ) ) { WP_CLI::error( 'This is not a valid thread ID.' ); } // Check if the user has access to this thread. $id = messages_check_thread_access( $thread_id, $user->ID ); if ( ! is_numeric( $id ) ) { WP_CLI::error( 'User has no access to this thread.' ); } $star_args = array( 'action' => 'star', 'thread_id' => $thread_id, 'user_id' => $user->ID, 'bulk' => true, ); if ( bp_messages_star_set_action( $star_args ) ) { WP_CLI::success( 'Thread was successfully starred.' ); } else { WP_CLI::error( 'Something wrong while trying to star the thread.' ); } }
Expand full source code Collapse full source code View on Trac