Changeset 5396
- Timestamp:
- 11/27/2011 07:00:33 PM (13 years ago)
- Location:
- trunk/bp-activity
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/admin/css/admin.css
r5339 r5396 1 #wp-bp-activities-wrap{padding:5px 0;}#bp-activities{height:120px;}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0;}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center;}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top;} 1 #wp-bp-activities-wrap{padding:5px 0;}#bp-activities{height:120px;}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0;}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center;}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top;}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px;} -
trunk/bp-activity/admin/css/admin.dev.css
r5339 r5396 2 2 padding: 5px 0; 3 3 } 4 5 4 #bp-activities { 6 5 height: 120px; 7 6 } 8 9 7 #bp-replyhead { 10 8 font-size: 1em; … … 12 10 margin: 0; 13 11 } 14 15 12 #bp-replysubmit { 16 13 margin: 0; … … 18 15 text-align: center; 19 16 } 20 21 17 #bp-replysubmit .error { 22 18 color: red; … … 25 21 vertical-align: center; 26 22 } 27 28 23 #bp-replysubmit img.waiting { 29 24 float: right; … … 31 26 vertical-align: top; 32 27 } 28 #bp-activities-form .column-response img { 29 float: left; 30 margin-right: 10px; 31 margin-top: 1px; 32 } -
trunk/bp-activity/bp-activity-admin.php
r5343 r5396 148 148 add_contextual_help( get_current_screen(), '<p>' . __( 'You can manage activities made on your site similar to the way you manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on activities using the on-hover action links or the Bulk Actions.', 'buddypress' ) . '</p>' . 149 149 '<p>' . __( 'There are many different types of activities. Some are generated by BuddyPress automatically, and others are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '</p>' . 150 151 150 '<p>' . __( 'In the Activity column, above each activity it says “Submitted on,” followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress' ) . '</p>' . 152 '<p>' . __( 'In the In Response To column, the text is the name of the user who generated the activity, and a link to the activity on your live site. The small bubble with the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.', 'buddypress' ) . '</p>'151 '<p>' . __( "In the In Response To Column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress' ) . '</p>' 153 152 ); 154 153 … … 163 162 // Enqueue CSS and JavaScript 164 163 wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js", array( 'jquery', 'wp-ajax-response' ), '20111120' ); 165 wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '2011112 0' );164 wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111126' ); 166 165 167 166 // Create the Activity screen list table … … 399 398 */ 400 399 public $spam_count = 0; 400 401 /** 402 * Store activity-to-user-ID mappings for use in the In Response To column. 403 * 404 * @since 1.6 405 */ 406 protected $activity_user_id = array(); 401 407 402 408 /** … … 488 494 // bp_activity_get returns an array of objects; cast these to arrays for WP_List_Table. 489 495 $new_activities = array(); 490 foreach ( $activities['activities'] as $activity_item ) 496 foreach ( $activities['activities'] as $activity_item ) { 491 497 $new_activities[] = (array) $activity_item; 498 499 // Build an array of activity-to-user ID mappings for better efficency in the In Response To column 500 $this->activity_user_id[$activity_item->id] = $activity_item->user_id; 501 } 492 502 493 503 // @todo If we're viewing a specific activity, check/merge $activity->children into the main list (recursive). … … 796 806 */ 797 807 function column_response( $item ) { 798 // Display link to user's profile799 echo bp_core_get_userlink( $item['user_id'] );800 801 808 // Get activity permalink 802 809 $activity_link = bp_activity_get_permalink( $item['id'], (object) $item ); 803 810 804 // Get the root activity ID by parsing the permalink; this may be not be the same as $item['id'] for nested items (e.g. activity_comments) 805 $root_activity_id = array(); 806 preg_match( '/\/p\/(\d+)\/*$/i', $activity_link, $root_activity_id ); 807 if ( empty( $root_activity_id[1] ) ) 808 return; 809 810 $root_activity_id = (int) $root_activity_id[1]; 811 // Get the root activity ID; this may be not be the same as $item['id'] for nested items (e.g. activity_comments) 812 $is_root_activity = empty( $item['item_id'] ); 813 $root_activity_id = $is_root_activity ? $item['id'] : $item['item_id']; 811 814 $root_activity_url = network_admin_url( 'admin.php?page=bp-activity&aid=' . $root_activity_id ); 812 815 813 // Is $item the root activity? 814 if ( (int) $item['id'] == $root_activity_id ) { 815 $root_activity = (object) $item; 816 817 // Get root activity comment count 818 $comment_count = !empty( $root_activity->children ) ? number_format_i18n( bp_activity_recurse_comment_count( $root_activity ) ) : 0; 819 $title_attr = sprintf( __( '%s related activities', 'buddypress' ), $comment_count ); 820 821 // Display a link to the root activity's permalink, with its comment count in a speech bubble 822 printf( '<br /><a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', $root_activity_url, esc_attr( $title_attr ), number_format_i18n( $comment_count ) ); 823 824 // $item is not the root activity (it is probably an activity_comment). 816 // Get comment count 817 if ( $is_root_activity ) 818 $comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0; 819 else 820 $comment_count = count( BP_Activity_Activity::get_child_comments( $item['id'] ) ); 821 822 if ( ! $is_root_activity ) { 823 // Display link to the replied-to activity's author's profile 824 echo '<strong>' . get_avatar( $this->get_activity_user_id( $item['item_id'] ), '32' ) . ' ' . bp_core_get_userlink( $this->get_activity_user_id( $item['item_id'] ) ) . '</strong><br />'; 825 } 826 827 // If the activity has comments, display a link to the root activity's permalink, with its comment count in a speech bubble 828 if ( $comment_count ) { 829 $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) ); 830 printf( '<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', $root_activity_url, esc_attr( $title_attr ), number_format_i18n( $comment_count ) ); 831 } 832 833 // Activity permalink 834 printf( __( '<a href="%1$s">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) ); 835 } 836 837 /** 838 * A wrapper function for the BP_Activity_List_Table to get the specified activity's user ID. 839 * 840 * @param int $activity_id Activity ID to retrieve User ID for 841 * @since 1.6 842 */ 843 protected function get_activity_user_id( $activity_id ) { 844 // If there is an existing activity/user ID mapping, just return the user ID. 845 if ( ! empty( $this->activity_user_id[$activity_id] ) ) { 846 return $this->activity_user_id[$activity_id]; 847 848 /** 849 * We don't have a mapping. This means the $activity_id is not on the current 850 * page of results, so fetch its details from the database. 851 */ 825 852 } else { 826 $comment_count = count( BP_Activity_Activity::get_child_comments( $item['id'] ) ); 827 828 // If a non-root activity has zero (child) comments, then don't show a zero bubble to keep the UI tidy 829 if ( 0 == $comment_count ) { 830 echo '<br />'; 831 832 } else { 833 $comment_count = number_format_i18n( $comment_count ); 834 $title_attr = sprintf( __( '%s related activities', 'buddypress' ), $comment_count ); 835 836 // Display a link to the root activity's permalink, with the current activity's (child) comment count in a speech bubble 837 printf( '<br /><a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', $root_activity_url, esc_attr( $title_attr ), number_format_i18n( $comment_count ) ); 838 } 853 $activity = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all', ) ); 854 855 /** 856 * If, somehow, the referenced activity has been deleted, leaving its associated 857 * activites as orphans, use the logged in user's ID to avoid errors. 858 */ 859 if ( empty( $activity['activities'] ) ) 860 return bp_loggedin_user_id(); 861 862 // Store the new activity/user ID mapping for any later re-use 863 $this->activity_user_id[ $activity['activities'][0]->id ] = $activity['activities'][0]->user_id; 864 865 // Return the user ID 866 return $activity['activities'][0]->user_id; 839 867 } 840 841 // Link to the activity permalink 842 printf( __( '<a href="%1$s">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) ); 843 } 844 }?> 868 } 869 } 870 ?> -
trunk/bp-activity/bp-activity-screens.php
r5329 r5396 195 195 196 196 // Get the activity details 197 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_current_action(), ' hide_spam' => true, 'show_hidden' => true) );197 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only', ) ); 198 198 199 199 // 404 if activity does not exist
Note: See TracChangeset
for help on using the changeset viewer.