Skip to:
Content

BuddyPress.org

Changeset 11309


Ignore:
Timestamp:
12/19/2016 10:40:38 PM (8 years ago)
Author:
slaffik
Message:

Messages: improved code formatting for messages_new_message()

Spaces, new lines etc, according to WordPress standards.

See #5193.

File:
1 edited

Legend:

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

    r11308 r11309  
    3737 *     @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'.
    3838 * }
    39  * @return int|bool ID of the message thread on success, false on failure.
     39 *
     40 * @return int|bool|WP_Error ID of the message thread on success, false on failure.
    4041 */
    4142function messages_new_message( $args = '' ) {
     
    5758            if ( empty( $r['sender_id'] ) ) {
    5859                $error_code = 'messages_empty_sender';
    59                 $feedback = __( 'Your message was not sent. Please use a valid sender.', 'buddypress' );
     60                $feedback   = __( 'Your message was not sent. Please use a valid sender.', 'buddypress' );
    6061            } else {
    6162                $error_code = 'messages_empty_content';
    62                 $feedback = __( 'Your message was not sent. Please enter some content.', 'buddypress' );
     63                $feedback   = __( 'Your message was not sent. Please enter some content.', 'buddypress' );
    6364            }
    6465
     
    114115
    115116        // Setup the recipients array.
    116         $recipient_ids      = array();
     117        $recipient_ids = array();
    117118
    118119        // Invalid recipients are added to an array, for future enhancements.
     
    120121
    121122        // Loop the recipients and convert all usernames to user_ids where needed.
    122         foreach( (array) $r['recipients'] as $recipient ) {
     123        foreach ( (array) $r['recipients'] as $recipient ) {
    123124
    124125            // Trim spaces and skip if empty.
     
    169170
    170171        // Format this to match existing recipients.
    171         foreach( (array) $recipient_ids as $i => $recipient_id ) {
    172             $message->recipients[$i]          = new stdClass;
    173             $message->recipients[$i]->user_id = $recipient_id;
     172        foreach ( (array) $recipient_ids as $i => $recipient_id ) {
     173            $message->recipients[ $i ]          = new stdClass;
     174            $message->recipients[ $i ]->user_id = $recipient_id;
    174175        }
    175176    }
Note: See TracChangeset for help on using the changeset viewer.