Changeset 13096 for trunk/src/bp-messages/bp-messages-functions.php
- Timestamp:
- 08/26/2021 12:53:27 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-functions.php
r12989 r13096 212 212 */ 213 213 function messages_send_notice( $subject, $message ) { 214 if ( !bp_current_user_can( 'bp_moderate' ) || empty( $subject ) || empty( $message ) ) { 214 215 if ( ! bp_current_user_can( 'bp_moderate' ) || empty( $subject ) || empty( $message ) ) { 215 216 return false; 216 217 // Has access to send notices, lets do it. 218 } else { 219 $notice = new BP_Messages_Notice; 220 $notice->subject = $subject; 221 $notice->message = $message; 222 $notice->date_sent = bp_core_current_time(); 223 $notice->is_active = 1; 224 $notice->save(); // Send it. 225 226 /** 227 * Fires after a notice has been successfully sent. 228 * 229 * @since 1.0.0 230 * 231 * @param string $subject Subject of the notice. 232 * @param string $message Content of the notice. 233 */ 234 do_action_ref_array( 'messages_send_notice', array( $subject, $message ) ); 235 236 return true; 237 } 217 } 218 219 $notice = new BP_Messages_Notice; 220 $notice->subject = $subject; 221 $notice->message = $message; 222 $notice->date_sent = bp_core_current_time(); 223 $notice->is_active = 1; 224 $notice->save(); // Send it. 225 226 /** 227 * Fires after a notice has been successfully sent. 228 * 229 * @since 1.0.0 230 * 231 * @param string $subject Subject of the notice. 232 * @param string $message Content of the notice. 233 * @param BP_Messages_Notice $notice Notice object sent. 234 */ 235 do_action_ref_array( 'messages_send_notice', array( $subject, $message, $notice ) ); 236 237 return true; 238 238 } 239 239 … … 276 276 $error = 0; 277 277 for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) { 278 if ( ! BP_Messages_Thread::delete( $thread_ids[ $i], $user_id ) ) {278 if ( ! BP_Messages_Thread::delete( $thread_ids[ $i ], $user_id ) ) { 279 279 $error = 1; 280 280 } … … 427 427 * @since 2.3.0 428 428 * 429 * @global BuddyPress $bp The one true BuddyPress instance. 430 * @global wpdb $wpdb WordPress database object. 431 * 429 432 * @param int $message_id ID of the message. 430 433 * @return int The ID of the thread if found, otherwise 0. … … 446 449 * 447 450 * @since 2.2.0 451 * 452 * @global wpdb $wpdb WordPress database object. 448 453 * 449 454 * @see delete_metadata() for full documentation excluding $meta_type variable. … … 579 584 580 585 // These should be extracted below. 581 $recipients = array(); 582 $email_subject = $email_content = ''; 583 $sender_id = 0; 586 $recipients = array(); 587 $sender_id = 0; 584 588 585 589 // Barf. … … 666 670 ); 667 671 } 668 669 $user_data_to_export = array();670 672 671 673 $user_threads = BP_Messages_Thread::get_current_threads_for_user( array( … … 717 719 ), 718 720 array( 719 'name' => __( 'Recipients', 'buddypress' ),721 'name' => __( 'Recipients', 'buddypress' ), 720 722 'value' => $recipients, 721 723 ),
Note: See TracChangeset
for help on using the changeset viewer.