Changeset 5696
- Timestamp:
- 02/10/2012 09:02:53 PM (14 years ago)
- Location:
- trunk/bp-messages
- Files:
-
- 10 edited
-
bp-messages-actions.php (modified) (2 diffs)
-
bp-messages-cache.php (modified) (1 diff)
-
bp-messages-classes.php (modified) (9 diffs)
-
bp-messages-cssjs.php (modified) (4 diffs)
-
bp-messages-filters.php (modified) (1 diff)
-
bp-messages-functions.php (modified) (10 diffs)
-
bp-messages-loader.php (modified) (3 diffs)
-
bp-messages-notifications.php (modified) (2 diffs)
-
bp-messages-screens.php (modified) (5 diffs)
-
bp-messages-template.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-actions.php
r5417 r5696 1 1 <?php 2 /******************************************************************************* 2 3 /** 4 * BuddyPress Messages Actions 5 * 3 6 * Action functions are exactly the same as screen functions, however they do not 4 7 * have a template screen associated with them. Usually they will send the user 5 8 * back to the default screen after execution. 9 * 10 * @package BuddyPress 11 * @subpackage SettingsLoader 6 12 */ 7 13 … … 108 114 } 109 115 add_action( 'bp_actions', 'messages_action_bulk_delete' ); 116 110 117 ?> -
trunk/bp-messages/bp-messages-cache.php
r4961 r5696 1 1 <?php 2 /******************************************************************************* 2 3 /** 4 * BuddyPress Messages Caching 5 * 3 6 * Caching functions handle the clearing of cached objects and pages on specific 4 7 * actions throughout BuddyPress. 8 * 9 * @package BuddyPress 10 * @subpackage SettingsLoader 5 11 */ 6 12 -
trunk/bp-messages/bp-messages-classes.php
r5302 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages Classes 5 * 6 * @package BuddyPress 7 * @subpackage MessagesClasses 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; 4 12 5 Class BP_Messages_Thread {13 class BP_Messages_Thread { 6 14 var $thread_id; 7 15 var $messages; … … 11 19 var $unread_count; 12 20 13 function bp_messages_thread ( $thread_id = false, $order = 'ASC' ) {14 $this->__construct( $thread_id, $order);15 }16 17 21 function __construct( $thread_id = false, $order = 'ASC' ) { 18 22 if ( $thread_id ) … … 54 58 global $wpdb, $bp; 55 59 56 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 57 58 foreach ( (array)$results as $recipient ) 60 $recipients = array(); 61 $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $this->thread_id ) ); 62 63 foreach ( (array) $results as $recipient ) 59 64 $recipients[$recipient->user_id] = $recipient; 60 65 … … 203 208 return count( $recipients ) . __(' Recipients', 'buddypress'); 204 209 210 $recipient_links = array(); 211 205 212 foreach ( (array)$recipients as $recipient ) 206 213 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); … … 241 248 } 242 249 243 Class BP_Messages_Message {250 class BP_Messages_Message { 244 251 var $id; 245 252 var $thread_id; … … 251 258 var $recipients = false; 252 259 253 function bp_messages_message( $id = null ) {254 $this->__construct( $id );255 }256 257 260 function __construct( $id = null ) { 258 global $bp;259 260 261 $this->date_sent = bp_core_current_time(); 261 262 $this->sender_id = bp_loggedin_user_id(); … … 344 345 if ( is_array( $recipient_usernames ) ) { 345 346 for ( $i = 0, $count = count( $recipient_usernames ); $i < $count; ++$i ) { 346 if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) ) 347 if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) ) { 347 348 $recipient_ids[] = $rid; 349 } 348 350 } 349 351 } … … 376 378 var $is_active; 377 379 378 function bp_messages_notice( $id = null ) {379 $this->__construct($id);380 }381 382 380 function __construct( $id = null ) { 383 381 if ( $id ) { … … 480 478 } 481 479 } 480 482 481 ?> -
trunk/bp-messages/bp-messages-cssjs.php
r5574 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages CSS and JS 5 * 6 * Apply WordPress defined filters to private messages 7 * 8 * @package BuddyPress 9 * @subpackage MessagesScripts 10 */ 11 2 12 // Exit if accessed directly 3 13 if ( !defined( 'ABSPATH' ) ) exit; 4 14 5 15 function messages_add_autocomplete_js() { 6 global $bp;7 16 8 17 // Include the autocomplete JS for composing a message. … … 27 36 28 37 function messages_add_autocomplete_css() { 29 global $bp;30 38 31 39 if ( bp_is_messages_component() && bp_is_current_action( 'compose' ) ) { 32 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 40 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { 33 41 wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), '20110723' ); 34 else42 } else { 35 43 wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), '20110723' ); 44 } 36 45 37 46 wp_print_styles(); … … 42 51 function messages_autocomplete_init_jsblock() { 43 52 ?> 53 44 54 <script type="text/javascript"> 45 55 jQuery(document).ready(function() { … … 53 63 }); 54 64 </script> 65 55 66 <?php 56 67 } 68 69 ?> -
trunk/bp-messages/bp-messages-filters.php
r4825 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages Filters 5 * 6 * Apply WordPress defined filters to private messages 7 * 8 * @package BuddyPress 9 * @subpackage MessagesFilters 10 */ 11 2 12 // Exit if accessed directly 3 13 if ( !defined( 'ABSPATH' ) ) exit; 4 14 5 /* Apply WordPress defined filters */ 6 add_filter( 'bp_get_message_notice_subject', 'wp_filter_kses', 1 ); 7 add_filter( 'bp_get_message_notice_text', 'wp_filter_kses', 1 ); 8 add_filter( 'bp_get_message_thread_subject', 'wp_filter_kses', 1 ); 9 add_filter( 'bp_get_message_thread_excerpt', 'wp_filter_kses', 1 ); 10 add_filter( 'bp_get_messages_subject_value', 'wp_filter_kses', 1 ); 11 add_filter( 'bp_get_messages_content_value', 'wp_filter_kses', 1 ); 12 add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 ); 15 add_filter( 'bp_get_message_notice_subject', 'wp_filter_kses', 1 ); 16 add_filter( 'bp_get_message_notice_text', 'wp_filter_kses', 1 ); 17 add_filter( 'bp_get_message_thread_subject', 'wp_filter_kses', 1 ); 18 add_filter( 'bp_get_message_thread_excerpt', 'wp_filter_kses', 1 ); 19 add_filter( 'bp_get_messages_subject_value', 'wp_filter_kses', 1 ); 20 add_filter( 'bp_get_messages_content_value', 'wp_filter_kses', 1 ); 21 add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 ); 13 22 14 23 add_filter( 'messages_message_content_before_save', 'wp_filter_kses', 1 ); 15 24 add_filter( 'messages_message_subject_before_save', 'wp_filter_kses', 1 ); 16 add_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );17 add_filter( 'messages_notice_subject_before_save', 'wp_filter_kses', 1 );25 add_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 ); 26 add_filter( 'messages_notice_subject_before_save', 'wp_filter_kses', 1 ); 18 27 19 add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );20 add_filter( 'bp_get_the_thread_subject', 'wp_filter_kses', 1 );28 add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 ); 29 add_filter( 'bp_get_the_thread_subject', 'wp_filter_kses', 1 ); 21 30 22 31 add_filter( 'messages_message_content_before_save', 'force_balance_tags' ); 23 32 add_filter( 'messages_message_subject_before_save', 'force_balance_tags' ); 24 add_filter( 'messages_notice_message_before_save', 'force_balance_tags' );25 add_filter( 'messages_notice_subject_before_save', 'force_balance_tags' );33 add_filter( 'messages_notice_message_before_save', 'force_balance_tags' ); 34 add_filter( 'messages_notice_subject_before_save', 'force_balance_tags' ); 26 35 27 add_filter( 'bp_get_message_notice_subject', 'wptexturize' );28 add_filter( 'bp_get_message_notice_text', 'wptexturize' );29 add_filter( 'bp_get_message_thread_subject', 'wptexturize' );30 add_filter( 'bp_get_message_thread_excerpt', 'wptexturize' );36 add_filter( 'bp_get_message_notice_subject', 'wptexturize' ); 37 add_filter( 'bp_get_message_notice_text', 'wptexturize' ); 38 add_filter( 'bp_get_message_thread_subject', 'wptexturize' ); 39 add_filter( 'bp_get_message_thread_excerpt', 'wptexturize' ); 31 40 add_filter( 'bp_get_the_thread_message_content', 'wptexturize' ); 32 41 33 add_filter( 'bp_get_message_notice_subject', 'convert_smilies', 2 );34 add_filter( 'bp_get_message_notice_text', 'convert_smilies', 2 );35 add_filter( 'bp_get_message_thread_subject', 'convert_smilies', 2 );36 add_filter( 'bp_get_message_thread_excerpt', 'convert_smilies', 2 );42 add_filter( 'bp_get_message_notice_subject', 'convert_smilies', 2 ); 43 add_filter( 'bp_get_message_notice_text', 'convert_smilies', 2 ); 44 add_filter( 'bp_get_message_thread_subject', 'convert_smilies', 2 ); 45 add_filter( 'bp_get_message_thread_excerpt', 'convert_smilies', 2 ); 37 46 add_filter( 'bp_get_the_thread_message_content', 'convert_smilies', 2 ); 38 47 39 add_filter( 'bp_get_message_notice_subject', 'convert_chars' );40 add_filter( 'bp_get_message_notice_text', 'convert_chars' );41 add_filter( 'bp_get_message_thread_subject', 'convert_chars' );42 add_filter( 'bp_get_message_thread_excerpt', 'convert_chars' );48 add_filter( 'bp_get_message_notice_subject', 'convert_chars' ); 49 add_filter( 'bp_get_message_notice_text', 'convert_chars' ); 50 add_filter( 'bp_get_message_thread_subject', 'convert_chars' ); 51 add_filter( 'bp_get_message_thread_excerpt', 'convert_chars' ); 43 52 add_filter( 'bp_get_the_thread_message_content', 'convert_chars' ); 44 53 45 add_filter( 'bp_get_message_notice_text', 'make_clickable', 9 );46 add_filter( 'bp_get_message_thread_excerpt', 'make_clickable', 9 );54 add_filter( 'bp_get_message_notice_text', 'make_clickable', 9 ); 55 add_filter( 'bp_get_message_thread_excerpt', 'make_clickable', 9 ); 47 56 add_filter( 'bp_get_the_thread_message_content', 'make_clickable', 9 ); 48 57 49 add_filter( 'bp_get_message_notice_text', 'wpautop' );58 add_filter( 'bp_get_message_notice_text', 'wpautop' ); 50 59 add_filter( 'bp_get_the_thread_message_content', 'wpautop' ); 51 60 52 add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );53 add_filter( 'bp_get_message_notice_text', 'stripslashes_deep' );54 add_filter( 'bp_get_message_thread_subject', 'stripslashes_deep' );55 add_filter( 'bp_get_message_thread_excerpt', 'stripslashes_deep' );56 add_filter( 'bp_get_messages_subject_value', 'stripslashes_deep' );57 add_filter( 'bp_get_messages_content_value', 'stripslashes_deep' );61 add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' ); 62 add_filter( 'bp_get_message_notice_text', 'stripslashes_deep' ); 63 add_filter( 'bp_get_message_thread_subject', 'stripslashes_deep' ); 64 add_filter( 'bp_get_message_thread_excerpt', 'stripslashes_deep' ); 65 add_filter( 'bp_get_messages_subject_value', 'stripslashes_deep' ); 66 add_filter( 'bp_get_messages_content_value', 'stripslashes_deep' ); 58 67 add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' ); 59 60 add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' ); 61 add_filter( 'bp_get_the_thread_subject', 'stripslashes_deep' ); 68 add_filter( 'bp_get_the_thread_subject', 'stripslashes_deep' ); 62 69 63 70 ?> -
trunk/bp-messages/bp-messages-functions.php
r5417 r5696 1 1 <?php 2 /******************************************************************************* 2 3 /** 4 * BuddyPress Messages Functions 5 * 3 6 * Business functions are where all the magic happens in BuddyPress. They will 4 7 * handle the actual saving or manipulation of information. Usually they will 5 8 * hand off to a database class for data access, then return 6 9 * true or false on success or failure. 10 * 11 * @package BuddyPress 12 * @subpackage MessagesFunctions 7 13 */ 8 14 … … 11 17 12 18 function messages_new_message( $args = '' ) { 13 global $bp;14 19 15 20 $defaults = array ( … … 144 149 $error = 0; 145 150 for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) { 146 if ( !$status = BP_Messages_Thread::delete( $thread_ids[$i]) ) 151 if ( !$status = BP_Messages_Thread::delete( $thread_ids[$i]) ) { 147 152 $error = 1; 153 } 148 154 } 149 155 … … 165 171 166 172 function messages_check_thread_access( $thread_id, $user_id = 0 ) { 167 global $bp;168 169 173 if ( empty( $user_id ) ) 170 174 $user_id = bp_loggedin_user_id(); … … 194 198 195 199 function messages_get_unread_count( $user_id = 0 ) { 196 global $bp;197 198 200 if ( empty( $user_id ) ) 199 201 $user_id = bp_loggedin_user_id(); … … 213 215 return BP_Messages_Thread::is_valid( $thread_id ); 214 216 } 215 216 /*******************************************************************************217 * These functions handle the recording, deleting and formatting of activity and218 * notifications for the user and for this specific component.219 */220 217 221 218 /** … … 231 228 */ 232 229 function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 233 global $bp;234 230 235 231 if ( 'new_message' == $action ) { … … 237 233 $title = __( 'Inbox', 'buddypress' ); 238 234 239 if ( (int) $total_items > 1 ) {235 if ( (int) $total_items > 1 ) { 240 236 $text = sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items ); 241 237 $filter = 'bp_messages_multiple_new_message_notification'; … … 252 248 'text' => $text, 253 249 'link' => $link 254 ), $link, (int) $total_items, $text, $link );250 ), $link, (int) $total_items, $text, $link ); 255 251 } 256 252 … … 259 255 return $return; 260 256 } 257 261 258 ?> -
trunk/bp-messages/bp-messages-loader.php
r5501 r5696 1 1 <?php 2 2 3 /** 3 * BuddyPress PrivateMessages Loader4 * BuddyPress Messages Loader 4 5 * 5 6 * A private messages component, for users to send messages to each other 6 7 * 7 8 * @package BuddyPress 8 * @subpackage Messages Core9 * @subpackage MessagesLoader 9 10 */ 10 11 … … 93 94 global $bp; 94 95 95 $name = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() ); 96 $sub_nav = array(); 97 $name = sprintf( __( 'Messages <span>%s</span>', 'buddypress' ), bp_get_total_unread_messages_count() ); 96 98 97 99 // Add 'Messages' to the main navigation … … 174 176 175 177 // Unread message count 176 if ( $count = messages_get_unread_count() ) { 177 $title = sprintf( __( 'Messages <span class="count">%s</span>', 'buddypress' ), $count ); 178 $inbox = sprintf( __( 'Inbox <span class="count">%s</span>', 'buddypress' ), $count ); 178 $count = messages_get_unread_count(); 179 if ( !empty( $count ) ) { 180 $title = sprintf( __( 'Messages <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) ); 181 $inbox = sprintf( __( 'Inbox <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) ); 179 182 } else { 180 183 $title = __( 'Messages', 'buddypress' ); -
trunk/bp-messages/bp-messages-notifications.php
r5445 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages Notifications 5 * 6 * @package BuddyPress 7 * @subpackage MessagesNotifications 8 */ 9 10 2 11 // Exit if accessed directly 3 12 if ( !defined( 'ABSPATH' ) ) exit; 4 13 5 function messages_notification_new_message( $args ) { 6 global $bp; 14 function messages_notification_new_message( $args = array() ) { 7 15 8 extract($args); 16 // These should be extracted below 17 $recipients = array(); 18 $email_subject = $email_content = ''; 9 19 10 $email_subject = $email_content = $args = ''; 11 $sender_name = bp_core_get_user_displayname( $sender_id ); 20 extract( $args ); 12 21 13 foreach( $recipients as $recipient ) { 14 if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) 15 continue; 22 $sender_name = bp_core_get_user_displayname( $sender_id ); 16 23 17 // User data and links 18 $ud = get_userdata( $recipient->user_id ); 19 $message_link = bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() .'/'; 20 $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; 21 $settings_link = bp_core_get_user_domain( $recipient->user_id ) . $settings_slug . '/notifications/'; 24 // Bail if no recipients 25 if ( ! empty( $recipients ) ) { 22 26 23 // Sender info 24 $sender_name = stripslashes( $sender_name ); 25 $subject = stripslashes( wp_filter_kses( $subject ) ); 26 $content = stripslashes( wp_filter_kses( $content ) ); 27 foreach( $recipients as $recipient ) { 27 28 28 // Set up and send the message 29 $email_to = $ud->user_email; 30 $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES ); 31 $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name ); 29 if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) 30 continue; 32 31 33 $email_content = sprintf( __( 32 // User data and links 33 $ud = get_userdata( $recipient->user_id ); 34 $message_link = bp_core_get_user_domain( $recipient->user_id ) . bp_get_messages_slug() .'/'; 35 $settings_slug = function_exists( 'bp_get_settings_slug' ) ? bp_get_settings_slug() : 'settings'; 36 $settings_link = bp_core_get_user_domain( $recipient->user_id ) . $settings_slug . '/notifications/'; 37 38 // Sender info 39 $sender_name = stripslashes( $sender_name ); 40 $subject = stripslashes( wp_filter_kses( $subject ) ); 41 $content = stripslashes( wp_filter_kses( $content ) ); 42 43 // Set up and send the message 44 $email_to = $ud->user_email; 45 $sitename = wp_specialchars_decode( get_blog_option( bp_get_root_blog_id(), 'blogname' ), ENT_QUOTES ); 46 $email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name ); 47 48 $email_content = sprintf( __( 34 49 '%1$s sent you a new message: 35 50 … … 43 58 ', 'buddypress' ), $sender_name, $subject, $content, $message_link ); 44 59 45 $email_content .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );60 $email_content .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link ); 46 61 47 // Send the message48 $email_to = apply_filters( 'messages_notification_new_message_to',$email_to );49 $email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name );50 $email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link );62 // Send the message 63 $email_to = apply_filters( 'messages_notification_new_message_to', $email_to ); 64 $email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name ); 65 $email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link ); 51 66 52 wp_mail( $email_to, $email_subject, $email_content ); 67 wp_mail( $email_to, $email_subject, $email_content ); 68 } 53 69 } 54 70 -
trunk/bp-messages/bp-messages-screens.php
r5417 r5696 1 1 <?php 2 /******************************************************************************* 2 3 /** 4 * BuddyPress Messages Screens 5 * 3 6 * Screen functions are the controllers of BuddyPress. They will execute when their 4 7 * specific URL is caught. They will first save or manipulate data using business 5 8 * functions, then pass on the user to a template file. 9 * 10 * @package BuddyPress 11 * @subpackage MessagesScreens 6 12 */ 7 13 … … 10 16 11 17 function messages_screen_inbox() { 12 global $bp;13 14 18 if ( bp_action_variables() ) { 15 19 bp_do_404(); … … 22 26 23 27 function messages_screen_sentbox() { 24 global $bp;25 26 28 if ( bp_action_variables() ) { 27 29 bp_do_404(); … … 129 131 130 132 function messages_screen_notification_settings() { 131 global $bp;132 133 133 if ( bp_action_variables() ) { 134 134 bp_do_404(); … … 140 140 141 141 if ( !$new_notices = bp_get_user_meta( bp_displayed_user_id(), 'notification_messages_new_notice', true ) ) 142 $new_notices = 'yes'; 143 ?> 142 $new_notices = 'yes'; ?> 144 143 145 144 <table class="notification-settings" id="messages-notification-settings"> -
trunk/bp-messages/bp-messages-template.php
r5641 r5696 1 1 <?php 2 3 /** 4 * BuddyPress Messages Template Tags 5 * 6 * @package BuddyPress 7 * @subpackage MessagesTemplate 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; 4 12 5 /** ***************************************************************************13 /** 6 14 * Message Box Template Class 7 * */8 Class BP_Messages_Box_Template {15 */ 16 class BP_Messages_Box_Template { 9 17 var $current_thread = -1; 10 18 var $current_thread_count; … … 211 219 } 212 220 function bp_get_message_thread_subject() { 213 global $messages_template , $message_template_subject;221 global $messages_template; 214 222 215 223 return apply_filters( 'bp_get_message_thread_subject', stripslashes_deep( $messages_template->thread->last_message_subject ) ); … … 307 315 } 308 316 function bp_get_message_thread_avatar() { 309 global $messages_template , $bp;317 global $messages_template; 310 318 311 319 return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $messages_template->thread->last_sender_id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $messages_template->thread->last_sender_id ) ) ) ) ); … … 397 405 398 406 function bp_messages_options() { 399 global $bp; 400 ?> 407 global $bp; ?> 408 401 409 <?php _e( 'Select:', 'buddypress' ) ?> 410 402 411 <select name="message-type-select" id="message-type-select"> 403 412 <option value=""></option> … … 406 415 <option value="all"><?php _e('All', 'buddypress') ?></option> 407 416 </select> 417 408 418 <?php if ( $bp->current_action != 'sentbox' && $bp->current_action != 'notices' ) : ?> 419 409 420 <a href="#" id="mark_as_read"><?php _e('Mark as Read', 'buddypress') ?></a> 410 421 <a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a> 422 411 423 <?php endif; ?> 424 412 425 <a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> 426 413 427 <?php 414 428 } … … 651 665 var $total_message_count; 652 666 653 function bp_messages_thread_template( $thread_id, $order ) {654 $this->__construct( $thread_id, $order );655 }656 657 667 function __construct( $thread_id, $order ) { 658 global $bp; 659 660 $this->thread = new BP_Messages_Thread( $thread_id, $order ); 668 $this->thread = new BP_Messages_Thread( $thread_id, $order ); 661 669 $this->message_count = count( $this->thread->messages ); 662 670 … … 704 712 705 713 function the_message() { 706 global $message;707 708 714 $this->in_the_loop = true; 709 $this->message = $this->next_message(); 710 711 if ( 0 == $this->current_message ) // loop has just started 715 $this->message = $this->next_message(); 716 717 // loop has just started 718 if ( 0 == $this->current_message ) 712 719 do_action('thread_loop_start'); 713 720 } … … 715 722 716 723 function bp_thread_has_messages( $args = '' ) { 717 global $ bp, $thread_template, $group_id;724 global $thread_template; 718 725 719 726 $defaults = array( 720 727 'thread_id' => false, 721 'order' => 'ASC'728 'order' => 'ASC' 722 729 ); 723 730 … … 725 732 extract( $r, EXTR_SKIP ); 726 733 727 if ( !$thread_id&& bp_is_messages_component() && bp_is_current_action( 'view' ) )728 $thread_id = (int) bp_action_variable( 0 );734 if ( empty( $thread_id ) && bp_is_messages_component() && bp_is_current_action( 'view' ) ) 735 $thread_id = (int) bp_action_variable( 0 ); 729 736 730 737 $thread_template = new BP_Messages_Thread_Template( $thread_id, $order ); … … 775 782 } 776 783 function bp_get_the_thread_recipients() { 777 global $thread_template , $bp;784 global $thread_template; 778 785 779 786 $recipient_links = array(); … … 811 818 812 819 $defaults = array( 813 'type' => 'thumb',814 'width' => false,820 'type' => 'thumb', 821 'width' => false, 815 822 'height' => false, 816 823 ); … … 882 889 } 883 890 add_action( 'messages_box_loop_start', 'bp_messages_embed' ); 891 884 892 ?>
Note: See TracChangeset
for help on using the changeset viewer.