Skip to:
Content

BuddyPress.org

Changeset 1655 for trunk/bp-messages.php


Ignore:
Timestamp:
08/13/2009 01:24:21 AM (17 years ago)
Author:
apeatling
Message:

Add first revision of new default BuddyPress parent theme. This theme is designed to be extended from with child themes, not used directly. The original default themes from the old two theme system are deprecated, but will remain compatible with 1.1. Still more work to do there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages.php

    r1651 r1655  
    284284        $thread_id = $bp->action_variables[0];
    285285       
    286         if ( !$thread_id || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) )
     286        if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_site_admin() ) )
    287287                bp_core_redirect( $bp->displayed_user->domain . $bp->current_component );
    288288               
    … …  
    291291               
    292292                /* Check the nonce */
    293                 check_admin_referer( 'messages_send_message' );
     293                check_admin_referer( 'messages_send_message', 'send_message_nonce' );
    294294               
    295295                /* Send the reply */
    … …  
    310310        global $bp, $thread_id;
    311311       
    312         if ( $bp->current_component != $bp->messages->slug || $bp->action_variables[0] != 'delete' )
     312        if ( $bp->current_component != $bp->messages->slug || 'notices' == $bp->current_action || $bp->action_variables[0] != 'delete' )
    313313                return false;
    314314       
    … …  
    453453        }
    454454       
    455         return $message->send();
     455        if ( $message->send() ) {
     456                require_once( BP_PLUGIN_DIR . '/bp-messages/bp-messages-notifications.php' );
     457
     458                // Send screen notifications to the recipients
     459                foreach ( $message->recipients as $recipient ) {
     460                        bp_core_add_notification( $message->id, $recipient, 'messages', 'new_message' );       
     461                }
     462               
     463                // Send email notifications to the recipients
     464                messages_notification_new_message( array( 'item_id' => $message->id, 'recipient_ids' => $message->recipients, 'thread_id' => $message->thread_id, 'component_name' => $bp->messages->slug, 'component_action' => 'message_sent', 'is_private' => 1 ) );
     465       
     466                do_action( 'messages_message_sent', &$message );
     467               
     468                return $message->thread_id;
     469        }
     470       
     471        return false;
    456472}
    457473
    … …  
    537553}
    538554
     555function messages_is_valid_thread( $thread_id ) {
     556        return BP_Messages_Thread::is_valid( $thread_id );
     557}
     558
    539559function messages_ajax_autocomplete_results() {
    540560        global $bp;
    … …  
    545565        if ( function_exists( 'friends_search_friends' ) )
    546566                $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
    547        
     567
    548568        $friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] );
    549569
    … …  
    552572                        $ud = get_userdata($user_id);
    553573                        $username = $ud->user_login;
    554                         echo  bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) )  . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
     574                        echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) )  . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
    555575                        ';
    556576                }               
Note: See TracChangeset for help on using the changeset viewer.