Changeset 5426
- Timestamp:
- 12/01/2011 04:34:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-admin.php
r5421 r5426 29 29 global $bp; 30 30 31 if ( ! bp_current_user_can( 'bp_moderate' ) )31 if ( ! bp_current_user_can( 'bp_moderate' ) ) 32 32 return; 33 33 34 34 // Add our screen 35 $hook = add_menu_page( __( ' Activity', 'buddypress' ), __( 'Activity', 'buddypress' ), 'manage_options', 'bp-activity', 'bp_activity_admin' );35 $hook = add_menu_page( __( 'BuddyPress Activities', 'buddypress' ), __( 'Activities', 'buddypress' ), 'manage_options', 'bp-activity', 'bp_activity_admin' ); 36 36 37 37 // Hook into early actions to load custom CSS and our init handler. … … 142 142 global $bp_activity_list_table; 143 143 144 // per_page screen option 145 add_screen_option( 'per_page', array( 'label' => _x( 'Activities', 'Activity items per page (screen options)', 'buddypress' )) ); 146 147 // Help panel - text 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 '<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 '<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>' . 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>' 152 ); 144 // Create the Activity screen list table 145 $bp_activity_list_table = new BP_Activity_List_Table(); 146 147 // Edit screen 148 if ( 'edit' == $bp_activity_list_table->current_action() && !empty( $_GET['aid'] ) ) { 149 // @todo Contextual help for the edit screen 150 151 // Index screen 152 } else { 153 // per_page screen option 154 add_screen_option( 'per_page', array( 'label' => _x( 'Activities', 'Activity items per page (screen options)', 'buddypress' )) ); 155 156 // Help panel - overview text 157 get_current_screen()->add_help_tab( array( 158 'id' => 'bp-activity-overview', 159 'title' => __( 'Overview', 'buddypress' ), 160 'content' => 161 '<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>' . 162 '<p>' . __( 'There are many different types of activities. Some are generated automatically by BuddyPress and other plugins, and some 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>' 163 ) ); 164 165 // Help panel - moderation text 166 get_current_screen()->add_help_tab( array( 167 'id' => 'bp-activity-moderating', 168 'title' => __( 'Moderating Activities', 'buddypress' ), 169 'content' => 170 '<ul>' . 171 '<li>' . __( 'In the <strong>Activity</strong> 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' ) . '</li>' . 172 '<li>' . __( "In the <strong>In Response To</strong> 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' ) . '</li>' . 173 '</ul>' 174 ) ); 175 176 // Enqueue CSS and JavaScript 177 $dev = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'dev.' : ''; 178 wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js", array( 'jquery', 'wp-ajax-response' ), '20111120' ); 179 wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111126' ); 180 } 153 181 154 182 // Help panel - sidebar links … … 157 185 '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>' 158 186 ); 159 160 $dev = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'dev.' : '';161 162 // Enqueue CSS and JavaScript163 wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js", array( 'jquery', 'wp-ajax-response' ), '20111120' );164 wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111126' );165 166 // Create the Activity screen list table167 $bp_activity_list_table = new BP_Activity_List_Table();168 187 169 188 // Handle spam/un-spam/delete of activities … … 287 306 * 288 307 * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table 308 * @since 1.6 309 */ 310 function bp_activity_admin() { 311 global $bp_activity_list_table; 312 313 // Display the single activity edit screen 314 if ( 'edit' == $bp_activity_list_table->current_action() && !empty( $_GET['aid'] ) ) 315 bp_activity_admin_edit(); 316 317 // Otherwise, display the Activity index screen 318 else 319 bp_activity_admin_index(); 320 } 321 322 /** 323 * Display the single activity edit screen 324 * 325 * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table 326 * @since 1.6 327 */ 328 function bp_activity_admin_edit() { 329 global $bp_activity_list_table; 330 } 331 332 /** 333 * Display the Activity admin index screen, which contains a list of all the activities. 334 * 335 * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table 289 336 * @global string $plugin_page 290 337 * @since 1.6 291 338 */ 292 function bp_activity_admin () {339 function bp_activity_admin_index() { 293 340 global $bp_activity_list_table, $plugin_page; 294 341 … … 314 361 $messages[] = sprintf( _n( '%s activity restored from the spam.', '%s activities restored from the spam.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) ); 315 362 316 // Handle the edit screen317 } elseif ( 'edit' == $bp_activity_list_table->current_action() && !empty( $_GET['aid'] ) ) {318 echo '@TODO: Activity Edit screen.';319 return;320 363 } 321 364 … … 328 371 <h2> 329 372 <?php if ( !empty( $_REQUEST['aid'] ) ) : ?> 330 <?php printf( __( 'Activit y (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?>373 <?php printf( __( 'Activities related to ID #%s', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?> 331 374 <?php else : ?> 332 <?php _e( 'Activit y', 'buddypress' ); ?>375 <?php _e( 'Activities', 'buddypress' ); ?> 333 376 <?php endif; ?> 334 377 … … 811 854 */ 812 855 function column_response( $item ) { 813 // Get activity permalink 814 $activity_link = bp_activity_get_permalink( $item['id'], (object) $item ); 815 816 // Get the root activity ID; this may be not be the same as $item['id'] for nested items (e.g. activity_comments) 817 if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) 818 $is_root_activity = true; 819 else 820 $is_root_activity = false; 821 822 $root_activity_id = $is_root_activity ? $item['id'] : $item['item_id']; 823 $root_activity_url = network_admin_url( 'admin.php?page=bp-activity&aid=' . $root_activity_id ); 824 825 // Get comment count 826 if ( $is_root_activity ) 827 $comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0; 828 else 829 $comment_count = count( BP_Activity_Activity::get_child_comments( $item['id'] ) ); 830 831 if ( ! $is_root_activity ) { 832 // Display link to the replied-to activity's author's profile 856 // Is $item is a root activity? 857 if ( empty( $item['item_id'] ) ) { 858 $comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0; 859 $root_activity_url = network_admin_url( 'admin.php?page=bp-activity&aid=' . $item['id'] ); 860 861 // If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble 862 if ( $comment_count ) { 863 $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) ); 864 printf( '<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', esc_attr( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) ); 865 } 866 867 // For non-root activities, display a link to the replied-to activity's author's profile 868 } else { 833 869 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 />'; 834 }835 836 // If the activity has comments, display a link to the root activity's permalink, with its comment count in a speech bubble837 if ( $comment_count ) {838 $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );839 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 ) );840 870 } 841 871
Note: See TracChangeset
for help on using the changeset viewer.