Skip to:
Content

BuddyPress.org

Changeset 659


Ignore:
Timestamp:
12/13/2008 07:02:15 PM (18 years ago)
Author:
apeatling
Message:
  • Added autocomplete of friends usernames
  • Fixed bugs with deleting messages
Location:
trunk/bp-messages
Files:
11 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-ajax.php

    r431 r659  
    2222        } else {
    2323                $result['message'] = '<img src="' . $bp['messages']['image_base'] . '/warning.gif" alt="Warning" /> &nbsp;' . $result['message'];
    24                 echo "-1|" . $result['message'];
     24                echo "-1[[split]]" . $result['message'];
    2525        }
    2626}
     
    3131
    3232        if ( !isset($_POST['thread_ids']) ) {
    33                 echo "-1|" . __('There was a problem marking messages as unread.', 'buddypress');
     33                echo "-1[[split]]" . __('There was a problem marking messages as unread.', 'buddypress');
    3434        } else {
    3535                $thread_ids = explode( ',', $_POST['thread_ids'] );
     
    4646       
    4747        if ( !isset($_POST['thread_ids']) ) {
    48                 echo "-1|" . __('There was a problem marking messages as read.', 'buddypress');
     48                echo "-1[[split]]" . __('There was a problem marking messages as read.', 'buddypress');
    4949        } else {
    5050                $thread_ids = explode( ',', $_POST['thread_ids'] );
     
    6161
    6262        if ( !isset($_POST['thread_ids']) ) {
    63                 echo "-1|" . __('There was a problem deleting messages.', 'buddypress');
     63                echo "-1[[split]]" . __( 'There was a problem deleting messages.', 'buddypress' );
    6464        } else {
    6565                $thread_ids = explode( ',', $_POST['thread_ids'] );
     
    6969                }
    7070               
    71                 echo __('Messages deleted.', 'buddypress');
     71                _e('Messages deleted.', 'buddypress');
    7272        }
    7373}
     
    7878
    7979        if ( !isset($_POST['notice_id']) ) {
    80                 echo "-1|" . __('There was a problem closing the notice.', 'buddypress');
     80                echo "-1[[split]]" . __('There was a problem closing the notice.', 'buddypress');
    8181        } else {
    8282                $notice_ids = get_usermeta( $userdata->ID, 'closed_notices' );
  • trunk/bp-messages/bp-messages-classes.php

    r656 r659  
    154154               
    155155                $delete_for_user = $wpdb->query( $wpdb->prepare( "UPDATE " . $bp['messages']['table_name_recipients'] . " SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, $bp['loggedin_userid'] ) );
    156 
     156               
    157157                // Check to see if any more recipients remain for this message
    158158                // if not, then delete the message from the database.
    159                 $recipients =  $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
     159                $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM " . $bp['messages']['table_name_recipients'] . " WHERE thread_id = %d AND is_deleted = 0", $thread_id ) );
    160160
    161161                if ( !$recipients ) {
     
    186186                        $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    187187                       
    188                 $sql = $wpdb->prepare( "SELECT r.thread_id FROM " . $bp['messages']['table_name_recipients'] . " r, " . $bp['messages']['table_name_threads'] . " t WHERE t.id = r.thread_id AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp['loggedin_userid'] );
     188                $sql = $wpdb->prepare( "SELECT r.thread_id FROM " . $bp['messages']['table_name_recipients'] . " r, " . $bp['messages']['table_name_threads'] . " t WHERE t.id = r.thread_id AND r.is_deleted = 0 AND r.user_id = %d$exclude_sender ORDER BY t.last_post_date DESC$pag_sql", $bp['loggedin_userid'] );
    189189
    190190                if ( !$thread_ids = $wpdb->get_results($sql) )
     
    255255                global $wpdb, $bp;
    256256
    257                 $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE user_id = %d", $bp['loggedin_userid'] );
     257                $sql = $wpdb->prepare( "SELECT unread_count FROM " . $bp['messages']['table_name_recipients'] . " WHERE user_id = %d AND is_deleted = 0", $bp['loggedin_userid'] );
    258258
    259259                if ( !$unread_counts = $wpdb->get_results($sql) )
  • trunk/bp-messages/bp-messages-cssjs.php

    r561 r659  
    3838        if ( $bp['current_component'] == $bp['messages']['slug'] )
    3939                wp_enqueue_script( 'bp-messages-js', site_url() . '/wp-content/mu-plugins/bp-messages/js/general.js' );
     40
     41        // Include the autocomplete JS for composing a message.
     42        if ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'compose') {
     43                wp_enqueue_script( 'bp-jquery-autocomplete', site_url() . '/wp-content/mu-plugins/bp-messages/js/autocomplete/jquery.autocomplete.js', 'jquery' );
     44                wp_enqueue_script( 'bp-jquery-autocomplete-fb', site_url() . '/wp-content/mu-plugins/bp-messages/js/autocomplete/jquery.autocompletefb.js', 'jquery' );
     45                wp_enqueue_script( 'bp-jquery-bgiframe', site_url() . '/wp-content/mu-plugins/bp-messages/js/autocomplete/jquery.bgiframe.min.js', 'jquery' );
     46                wp_enqueue_script( 'bp-jquery-dimensions', site_url() . '/wp-content/mu-plugins/bp-messages/js/autocomplete/jquery.dimensions.js', 'jquery' ); 
     47                wp_enqueue_script( 'bp-autocomplete-init', site_url() . '/wp-content/mu-plugins/bp-messages/js/autocomplete/init.php', 'jquery' );     
     48
     49        }
     50
    4051}
    4152add_action( 'template_redirect', 'messages_add_js' );
     53
     54function messages_add_css() {
     55        global $bp;
     56       
     57        if ( $bp['current_component'] == $bp['messages']['slug'] && $bp['current_action'] == 'compose') {
     58                wp_enqueue_style( 'bp-messages-autocomplete', site_url() . '/wp-content/mu-plugins/bp-messages/css/autocomplete/jquery.autocompletefb.css' );   
     59                wp_print_styles();
     60        }
     61}
     62add_action( 'wp_head', 'messages_add_css' );
     63
    4264
    4365function messages_add_structure_css() {
  • trunk/bp-messages/bp-messages-templatetags.php

    r656 r659  
    152152function bp_message_thread_delete_link() {
    153153        global $messages_template, $bp;
    154         echo apply_filters( 'bp_message_thread_delete_link', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/delete/' . $messages_template->thread->thread_id );
     154        echo apply_filters( 'bp_message_thread_delete_link', $bp['loggedin_domain'] . $bp['messages']['slug'] . '/' . $bp['current_action'] . '/delete/' . $messages_template->thread->thread_id );
    155155}
    156156
     
    320320}
    321321
     322function bp_message_loading_image_src() {
     323        global $bp;
     324        echo $bp['messages']['image_base'] . '/ajax-loader.gif';
     325}
     326
    322327?>
  • trunk/bp-messages/js/general.js

    r199 r659  
    5050                               
    5151                                setTimeout( function() {
    52                                         var err_num = response.split('|');
     52                                        var err_num = response.split('[[split]]');
    5353                                        if ( err_num[0] == "-1" ) {
    5454                                                response = err_num[1];
     
    9797                        function(response) {
    9898                                response = response.substr(0, response.length-1);
    99                                 var err_num = response.split('|');
     99                                var err_num = response.split('[[split]]');
    100100                                if ( err_num[0] == "-1" ) {
    101101                                        // error
     
    140140                        function(response) {
    141141                                response = response.substr(0, response.length-1);
    142                                 var err_num = response.split('|');
     142                                var err_num = response.split('[[split]]');
    143143                                if ( err_num[0] == "-1" ) {
    144144                                        // error
     
    183183                        function(response) {
    184184                                response = response.substr(0, response.length-1);
    185                                 var err_num = response.split('|');
     185                                var err_num = response.split('[[split]]');
    186186                               
    187187                                jQuery('#message').remove();
     
    206206                        function(response) {
    207207                                response = response.substr(0, response.length-1);
    208                                 var err_num = response.split('|');
     208                                var err_num = response.split('[[split]]');
    209209
    210210                                if ( err_num[0] == "-1" ) {
     
    247247                        }
    248248                }
    249         );     
     249        );
    250250});
Note: See TracChangeset for help on using the changeset viewer.