Changeset 2397
- Timestamp:
- 01/21/2010 03:47:02 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2389 r2397 598 598 } 599 599 600 /** 601 * bp_activity_get_activity_id() 602 * 603 * Fetch the activity_id for an existing activity entry in the DB. 604 * 605 * @package BuddyPress Activity 606 */ 607 function bp_activity_get_activity_id( $args = '' ) { 608 $defaults = array( 609 'user_id' => false, 610 'component' => false, 611 'type' => false, 612 'item_id' => false, 613 'secondary_item_id' => false 614 ); 615 616 $r = wp_parse_args( $args, $defaults ); 617 extract( $r, EXTR_SKIP ); 618 619 return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $user_id, $component, $type, $item_id, $secondary_item_id ) ); 620 } 621 600 622 /*** 601 623 * Deleting Activity … … 712 734 } 713 735 736 /** 737 * bp_activity_thumnail_content_images() 738 * 739 * Take content, remove all images and replace them with one thumbnail image. 740 * 741 * @package BuddyPress Activity 742 * @param $content str - The content to work with 743 * @return $content str - The content with images stripped and replaced with a single thumb. 744 */ 714 745 function bp_activity_thumnail_content_images( $content ) { 715 746 preg_match_all( '/<img[^>]*>/Ui', $content, $matches ); … … 742 773 } 743 774 744 return $content;775 return apply_filters( 'bp_activity_thumnail_content_images', $content, $matches ); 745 776 } 746 777 -
trunk/bp-activity/bp-activity-classes.php
r2381 r2397 295 295 } 296 296 297 function get_id( $user_id, $component, $type, $item_id, $secondary_item_id ) { 298 global $bp, $wpdb; 299 300 $where_args = false; 301 302 if ( !empty( $user_id ) ) 303 $where_args[] = $wpdb->prepare( "user_id = %d", $user_id ); 304 305 if ( !empty( $component ) ) 306 $where_args[] = $wpdb->prepare( "component = %s", $component ); 307 308 if ( !empty( $type ) ) 309 $where_args[] = $wpdb->prepare( "type = %s", $type ); 310 311 if ( !empty( $item_id ) ) 312 $where_args[] = $wpdb->prepare( "item_id = %s", $item_id ); 313 314 if ( !empty( $secondary_item_id ) ) 315 $where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id ); 316 317 if ( !empty( $where_args ) ) 318 $where_sql = 'WHERE ' . join( ' AND ', $where_args ); 319 else 320 return false; 321 322 return $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ); 323 } 324 297 325 function append_comments( $activities ) { 298 326 global $bp, $wpdb; -
trunk/bp-blogs.php
r2394 r2397 270 270 $content = apply_filters( 'bp_blogs_record_activity_content', "<blockquote>" . bp_create_excerpt( $content ) . "</blockquote>" ); 271 271 272 return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 272 /* Check for an existing entry and update if one exists. */ 273 $id = bp_activity_get_activity_id( array( 274 'user_id' => $user_id, 275 'component' => $component, 276 'type' => $type, 277 'item_id' => $item_id, 278 'secondary_item_id' => $secondary_item_id 279 ) ); 280 281 return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 273 282 } 274 283 … … 418 427 $existing_post = new BP_Blogs_Post( null, $blog_id, $post_id ); 419 428 420 /* Delete and the activity stream item as we are probably going to re-add it later with new info. */421 bp_blogs_delete_activity( array( 'item_id' => $existing_post->id, 'component' => $bp->blogs->slug, 'type' => 'new_blog_post' ) );422 423 429 /* Delete the recorded post if the status is not published or it is password protected */ 424 430 if ( 'publish' != $post->post_status || '' != $post->post_password ) { … … 441 447 $activity_content = $post->post_content; 442 448 443 /* Record this in activity streams */444 449 bp_blogs_record_activity( array( 445 450 'user_id' => (int)$post->post_author, … … 449 454 'type' => 'new_blog_post', 450 455 'item_id' => $blog_id, 451 'secondary_item_id' => $ existing_post->id,456 'secondary_item_id' => $post_id, 452 457 'recorded_time' => strtotime( $post->post_date_gmt ) 453 458 ) ); -
trunk/bp-groups.php
r2389 r2397 1333 1333 extract( $r, EXTR_SKIP ); 1334 1334 1335 return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 1335 /* Check for an existing entry and update if one exists. */ 1336 $id = bp_activity_get_activity_id( array( 1337 'user_id' => $user_id, 1338 'component' => $component, 1339 'type' => $type, 1340 'item_id' => $item_id, 1341 'secondary_item_id' => $secondary_item_id 1342 ) ); 1343 1344 return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 1336 1345 } 1337 1346 -
trunk/bp-messages.php
r2389 r2397 174 174 } else { 175 175 /* If this is a notice, send it */ 176 if ( isset($_POST['send-notice']) ) { 177 messages_send_notice( $_POST['subject'], $_POST['content'] ); 176 if ( isset( $_POST['send-notice'] ) ) { 177 if ( messages_send_notice( $_POST['subject'], $_POST['content'] ) ) { 178 bp_core_add_message( __( 'Notice sent successfully!', 'buddypress' ) ); 179 bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug . '/inbox/' ); 180 } else { 181 bp_core_add_message( __( 'There was an error sending that notice, please try again', 'buddypress' ), 'error' ); 182 } 178 183 } else { 179 184 /* Filter recipients into the format we need - array( 'username/userid', 'username/userid' ) */ … … 420 425 /* If we have a thread ID, use the existing recipients, otherwise use the recipients passed */ 421 426 if ( $thread_id ) { 422 $thread = new BP_Messages_Thread( $thread_id);427 $thread = new BP_Messages_Thread( $thread_id ); 423 428 $message->recipients = $thread->get_recipients(); 424 429 } else { -
trunk/bp-messages/bp-messages-templatetags.php
r2389 r2397 162 162 global $messages_template; 163 163 164 return apply_filters( 'bp_get_message_thread_id', $messages_template->thread->thread_id ); 164 /* Notice support */ 165 if ( empty( $messages_template->thread->thread_id ) ) 166 $id = $messages_template->thread->id; 167 else 168 $id = $messages_template->thread->thread_id; 169 170 return apply_filters( 'bp_get_message_thread_id', $id ); 165 171 } 166 172 … … 170 176 function bp_get_message_thread_subject() { 171 177 global $messages_template; 172 return apply_filters( 'bp_get_message_thread_subject', stripslashes_deep( $messages_template->thread->last_message_subject ) ); 178 179 /* Notice support */ 180 if ( empty( $messages_template->thread->last_message_subject ) ) 181 $subject = $messages_template->thread->subject; 182 else 183 $subject = $messages_template->thread->last_message_subject; 184 185 return apply_filters( 'bp_get_message_thread_subject', stripslashes_deep( $subject ) ); 173 186 } 174 187 … … 178 191 function bp_get_message_thread_excerpt() { 179 192 global $messages_template; 180 return apply_filters( 'bp_get_message_thread_excerpt', strip_tags( bp_create_excerpt($messages_template->thread->last_message_message, 10 ) ) ); 193 194 /* Notice support */ 195 if ( empty( $messages_template->thread->last_message_message ) ) 196 $message = $messages_template->thread->message; 197 else 198 $message = $messages_template->thread->last_message_message; 199 200 return apply_filters( 'bp_get_message_thread_excerpt', strip_tags( bp_create_excerpt( $message, 10 ) ) ); 181 201 } 182 202 … … 185 205 } 186 206 function bp_get_message_thread_from() { 187 global $messages_template; 188 return apply_filters( 'bp_get_message_thread_from', bp_core_get_userlink($messages_template->thread->last_sender_id) ); 207 global $messages_template, $bp; 208 209 /* Notice support */ 210 if ( empty( $messages_template->thread->last_sender_id ) ) 211 $sender = $bp->loggedin_user->id; 212 else 213 $sender = $messages_template->thread->last_sender_id; 214 215 return apply_filters( 'bp_get_message_thread_from', bp_core_get_userlink($sender) ); 189 216 } 190 217 … … 239 266 function bp_get_message_thread_last_post_date() { 240 267 global $messages_template; 241 echo apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime($messages_template->thread->last_post_date) ) ); 268 269 /* Notice support */ 270 if ( empty( $messages_template->thread->last_post_date ) ) 271 $date = $messages_template->thread->date_sent; 272 else 273 $date = $messages_template->thread->last_post_date; 274 275 echo apply_filters( 'bp_get_message_thread_last_post_date', bp_format_time( strtotime($date) ) ); 242 276 } 243 277 … … 246 280 } 247 281 function bp_get_message_thread_avatar() { 248 global $messages_template; 249 echo apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $messages_template->thread->last_sender_id, 'type' => 'thumb' ) ) ); 282 global $messages_template, $bp; 283 284 /* Notice support */ 285 if ( empty( $messages_template->thread->last_sender_id ) ) 286 $sender = $bp->loggedin_user->id; 287 else 288 $sender = $messages_template->thread->last_sender_id; 289 290 echo apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $sender, 'type' => 'thumb' ) ) ); 250 291 } 251 292 … … 318 359 function bp_messages_options() { 319 360 global $bp; 320 321 if ( $bp->current_action != 'sentbox' ) {322 361 ?> 323 <?php _e( 'Select:', 'buddypress' ) ?> 324 <select name="message-type-select" id="message-type-select"> 325 <option value=""></option> 326 <option value="read"><?php _e('Read', 'buddypress') ?></option> 327 <option value="unread"><?php _e('Unread', 'buddypress') ?></option> 328 <option value="all"><?php _e('All', 'buddypress') ?></option> 329 </select> 362 <?php _e( 'Select:', 'buddypress' ) ?> 363 <select name="message-type-select" id="message-type-select"> 364 <option value=""></option> 365 <option value="read"><?php _e('Read', 'buddypress') ?></option> 366 <option value="unread"><?php _e('Unread', 'buddypress') ?></option> 367 <option value="all"><?php _e('All', 'buddypress') ?></option> 368 </select> 369 <?php if ( $bp->current_action != 'sentbox' && $bp->current_action != 'notices' ) : ?> 330 370 <a href="#" id="mark_as_read"><?php _e('Mark as Read', 'buddypress') ?></a> 331 371 <a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a> 332 <?php }?>372 <?php endif; ?> 333 373 <a href="#" id="delete_<?php echo $bp->current_action ?>_messages"><?php _e('Delete Selected', 'buddypress') ?></a> 334 374 <?php … … 418 458 419 459 $notice = BP_Messages_Notice::get_active(); 420 $closed_notices = get_usermeta( $userdata->ID, 'closed_notices'); 460 461 if ( empty( $notice ) ) 462 return false; 463 464 $closed_notices = get_usermeta( $userdata->ID, 'closed_notices' ); 421 465 422 466 if ( !$closed_notices ) … … 426 470 if ( !in_array( $notice->id, $closed_notices ) && $notice->id ) { 427 471 ?> 428 <div class="notice" id="<?php echo $notice->id ?>"> 429 <h5><?php echo stripslashes($notice->subject) ?></h5> 430 <?php echo stripslashes($notice->message) ?> 431 <a href="#" id="close-notice"><?php _e( 'Close', 'buddypress' ) ?></a> 472 <div id="message" class="info notice" rel="n-<?php echo $notice->id ?>"> 473 <p> 474 <strong><?php echo stripslashes( wp_filter_kses( $notice->subject ) ) ?></strong><br /> 475 <?php echo stripslashes( wp_filter_kses( $notice->message) ) ?> 476 <a href="#" id="close-notice"><?php _e( 'Close', 'buddypress' ) ?></a> 477 </p> 432 478 </div> 433 479 <?php -
trunk/bp-themes/bp-default/_inc/ajax.php
r2372 r2397 425 425 add_action( 'wp_ajax_joinleave_group', 'bp_dtheme_ajax_joinleave_group' ); 426 426 427 function bp_dtheme_ajax_close_notice() { 428 global $userdata; 429 430 if ( !isset( $_POST['notice_id'] ) ) { 431 echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>'; 432 } else { 433 $notice_ids = get_usermeta( $userdata->ID, 'closed_notices' ); 434 435 $notice_ids[] = (int) $_POST['notice_id']; 436 437 update_usermeta( $userdata->ID, 'closed_notices', $notice_ids ); 438 } 439 } 440 add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' ); 441 427 442 function bp_dtheme_ajax_messages_send_reply() { 428 443 global $bp; … … 460 475 add_action( 'wp_ajax_messages_send_reply', 'bp_dtheme_ajax_messages_send_reply' ); 461 476 462 function bp_dtheme_ajax_m arkunread() {477 function bp_dtheme_ajax_message_markunread() { 463 478 global $bp; 464 479 … … 473 488 } 474 489 } 475 add_action( 'wp_ajax_messages_markunread', 'bp_dtheme_ajax_m arkunread' );490 add_action( 'wp_ajax_messages_markunread', 'bp_dtheme_ajax_message_markunread' ); 476 491 477 492 function bp_dtheme_ajax_message_markread() { … … 488 503 } 489 504 } 490 add_action( 'wp_ajax_messages_markread', 'bp_dtheme_ajax_message s_markread' );505 add_action( 'wp_ajax_messages_markread', 'bp_dtheme_ajax_message_markread' ); 491 506 492 507 function bp_dtheme_ajax_messages_delete() { -
trunk/bp-themes/bp-default/_inc/css/default.css
r2383 r2397 1433 1433 text-align: right; 1434 1434 } 1435 a#delete_inbox_messages , .sentbox div.messages-options-nav{1435 a#delete_inbox_messages { 1436 1436 display: none; 1437 1437 } -
trunk/bp-themes/bp-default/_inc/global.js
r2381 r2397 493 493 }); 494 494 495 /* Hide long lists of activity comments, only show the latest five root comments. */ 495 496 function bp_dtheme_hide_comments() { 496 497 var comments_divs = j('div.activity-comments'); … … 526 527 /**** Directory Search ****************************************************/ 527 528 529 /* The search form on all directory pages */ 528 530 j('div.dir-search').click( function(event) { 529 531 var target = j(event.target); … … 541 543 /**** Tabs and Filters ****************************************************/ 542 544 545 /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */ 543 546 j('div.item-list-tabs').click( function(event) { 544 547 if ( j(this).hasClass('no-ajax') ) … … 570 573 }); 571 574 575 /* When the filter select box is changed re-query */ 572 576 j('li.filter select').change( function() { 573 577 if ( j('div.item-list-tabs li.selected').length ) … … 587 591 }); 588 592 593 /* Filter the current content list (groups/members/blogs/topics) */ 589 594 function bp_filter_request( type, filter, id, target, page, search_terms, extras ) { 590 595 if ( 'activity' == id ) … … 646 651 } 647 652 648 /* Pagination Links*/653 /* All pagination links run through this function */ 649 654 j('div#content').click( function(event) { 650 655 var target = j(event.target); … … 684 689 /**** New Forum Directory Post **************************************/ 685 690 691 /* Hit the "New Topic" button on the forums directory page */ 686 692 j('a#new-topic-button').click( function() { 687 693 if ( !j('div#new-topic-post').length ) … … 696 702 }); 697 703 704 /* Cancel the posting of a new forum topic */ 698 705 j('input#submit_topic_cancel').click( function() { 699 706 if ( !j('div#new-topic-post').length ) … … 706 713 /** Invite Friends Interface ****************************************/ 707 714 715 /* Select a user from the list of friends and add them to the invite list */ 708 716 j("div#invite-list input").click( function() { 709 717 j('.ajax-loader').toggle(); … … 743 751 }); 744 752 753 /* Remove a user from the list of users to invite to a group */ 745 754 j("#friend-list li a.remove").live('click', function() { 746 755 j('.ajax-loader').toggle(); … … 770 779 /** Friendship Requests **************************************/ 771 780 781 /* Accept and Reject friendship request buttons */ 772 782 j("ul#friend-list a.accept, ul#friend-list a.reject").click( function() { 773 783 var button = j(this); … … 816 826 }); 817 827 828 /* Add / Remove friendship buttons */ 818 829 j("div.friendship-button a").live('click', function() { 819 830 j(this).parent().addClass('loading'); … … 924 935 /** Private Messaging ******************************************/ 925 936 937 /* AJAX send reply functionality */ 926 938 j("input#send_reply_button").click( 927 939 function() { … … 964 976 ); 965 977 978 /* Marking private messages as read and unread */ 966 979 j("a#mark_as_read, a#mark_as_unread").click( 967 980 function() { … … 1019 1032 ); 1020 1033 1034 /* Selecting unread and read messages in inbox */ 1021 1035 j("select#message-type-select").change( 1022 1036 function() { … … 1047 1061 ); 1048 1062 1063 /* Close site wide notices in the sidebar */ 1064 j("a#close-notice").click( function() { 1065 j(this).addClass('loading'); 1066 j('div#sidebar div.error').remove(); 1067 1068 j.post( ajaxurl, { 1069 action: 'messages_close_notice', 1070 'notice_id': j('.notice').attr('rel').substr( 2, j('.notice').attr('rel').length ) 1071 }, 1072 function(response) { 1073 j("a#close-notice").removeClass('loading'); 1074 1075 if ( response[0] + response[1] == '-1' ) { 1076 j('.notice').prepend( response.substr( 2, response.length ) ); 1077 j( 'div#sidebar div.error').hide().fadeIn( 200 ); 1078 } else { 1079 j('.notice').slideUp( 100 ); 1080 } 1081 }); 1082 return false; 1083 }); 1084 1049 1085 /* Admin Bar Javascript */ 1050 1086 j("#wp-admin-bar ul.main-nav li").mouseover( function() { -
trunk/bp-themes/bp-default/members/single/messages.php
r2287 r2397 16 16 17 17 <div class="messages"> 18 <?php locate_template( array( 'members/single/messages/messages-loop.php' ), true ) ?> 18 <?php if ( 'notices' == bp_current_action() ) : ?> 19 <?php locate_template( array( 'members/single/messages/notices-loop.php' ), true ) ?> 20 21 <?php else : ?> 22 <?php locate_template( array( 'members/single/messages/messages-loop.php' ), true ) ?> 23 24 <?php endif; ?> 19 25 </div> 20 26 -
trunk/bp-themes/bp-default/members/single/messages/messages-loop.php
r2284 r2397 16 16 17 17 <?php do_action( 'bp_after_member_messages_pagination' ) ?> 18 19 <div class="messages-options-nav">20 <?php bp_messages_options() ?>21 </div><!-- .messages-options-nav -->22 23 18 <?php do_action( 'bp_before_member_messages_threads' ) ?> 24 19 … … 32 27 <td width="1%" class="thread-avatar"><?php bp_message_thread_avatar() ?></td> 33 28 <td width="30%" class="thread-from"> 34 <?php _e( "From:", "buddypress"); ?> <?php bp_message_thread_from() ?><br />29 <?php _e( 'From:', 'buddypress' ); ?> <?php bp_message_thread_from() ?><br /> 35 30 <span class="activity"><?php bp_message_thread_last_post_date() ?></span> 36 31 </td> … … 51 46 </table><!-- #message-threads --> 52 47 53 <?php do_action( 'bp_after_member_messages_threads' ) ?>54 55 48 <div class="messages-options-nav"> 56 49 <?php bp_messages_options() ?> 57 </div> 50 </div><!-- .messages-options-nav --> 51 52 <?php do_action( 'bp_after_member_messages_threads' ) ?> 58 53 59 54 <?php do_action( 'bp_after_member_messages_options' ) ?> -
trunk/bp-themes/bp-default/sidebar.php
r2302 r2397 12 12 <h3><?php bp_loggedinuser_link() ?></h3> 13 13 <a class="button" href="<?php echo wp_logout_url(wp_get_referer()) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> 14 14 15 </div> 16 17 <?php if ( function_exists( 'bp_message_get_notices' ) ) : ?> 18 <?php bp_message_get_notices(); /* Site wide notices to all users */ ?> 19 <?php endif; ?> 15 20 16 21 <?php else : ?> -
trunk/bp-xprofile.php
r2389 r2397 498 498 extract( $r, EXTR_SKIP ); 499 499 500 return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 500 /* Check for an existing entry and update if one exists. */ 501 $id = bp_activity_get_activity_id( array( 502 'user_id' => $user_id, 503 'component' => $component, 504 'type' => $type, 505 'item_id' => $item_id, 506 'secondary_item_id' => $secondary_item_id 507 ) ); 508 509 return bp_activity_add( array( 'id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) ); 501 510 } 502 511
Note: See TracChangeset
for help on using the changeset viewer.