Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/26/2021 12:53:27 AM (5 years ago)
Author:
espellcaste
Message:

Making PHPDoc Improvements to the BP Messages (component) files.

Also, adding several minor PHP changes.

See #8553

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-functions.php

    r12989 r13096  
    212212 */
    213213function 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 ) ) {
    215216                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;
    238238}
    239239
     
    276276                $error = 0;
    277277                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 ) ) {
    279279                                $error = 1;
    280280                        }
     
    427427 * @since 2.3.0
    428428 *
     429 * @global BuddyPress $bp The one true BuddyPress instance.
     430 * @global wpdb $wpdb WordPress database object.
     431 *
    429432 * @param  int $message_id ID of the message.
    430433 * @return int The ID of the thread if found, otherwise 0.
     
    446449 *
    447450 * @since 2.2.0
     451 *
     452 * @global wpdb $wpdb WordPress database object.
    448453 *
    449454 * @see delete_metadata() for full documentation excluding $meta_type variable.
     
    579584
    580585        // These should be extracted below.
    581         $recipients    = array();
    582         $email_subject = $email_content = '';
    583         $sender_id     = 0;
     586        $recipients = array();
     587        $sender_id  = 0;
    584588
    585589        // Barf.
     
    666670                );
    667671        }
    668 
    669         $user_data_to_export = array();
    670672
    671673        $user_threads = BP_Messages_Thread::get_current_threads_for_user( array(
     
    717719                                ),
    718720                                array(
    719                                         'name' => __( 'Recipients', 'buddypress' ),
     721                                        'name'  => __( 'Recipients', 'buddypress' ),
    720722                                        'value' => $recipients,
    721723                                ),
Note: See TracChangeset for help on using the changeset viewer.