Ticket #1202: functions.bb-admin.php.diff
| File functions.bb-admin.php.diff, 4.0 KB (added by Gautam Gupta, 2 years ago) |
|---|
-
functions.bb-admin.php
411 411 return $ids; 412 412 } 413 413 414 function bb_user_row( $user, $role = '', $email = false ) {414 function bb_user_row( $user, $role = '', $email = false, $delete = false ) { 415 415 $actions = "<a href='" . esc_attr( get_user_profile_link( $user->ID ) ) . "'>" . __('View') . "</a>"; 416 416 $title = ''; 417 417 if ( bb_current_user_can( 'edit_user', $user_id ) ) { 418 $actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __('Edit') . "</a>"; 418 $actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __( 'Edit' ) . "</a>"; 419 $actions .= bb_get_user_delete_link( array( 'id' => $user->ID, 'before' => ' | ', 'after' => '', 'delete_text' => __( 'Delete' ) ) ); 419 420 $title = " title='" . esc_attr( sprintf( __( 'User ID: %d' ), $user->ID ) ) . "'"; 420 421 } 421 422 $r = "\t<tr id='user-$user->ID'" . get_alt_class("user-$role") . ">\n"; 423 if ( $delete ) { 424 $r .= "\t\t<td class=\"check-column\"><input type=\"checkbox\" name=\"user[]\" value=\"" . $user->ID . "\" /></td> \n"; 425 } 422 426 $r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "'" . $title . ">" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span> </div></td>\n"; 423 427 $r .= "\t\t<td><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_display_name( $user->ID ) . "</a></td>\n"; 424 428 if ( $email ) { … … 563 567 return false; 564 568 } 565 569 566 function display( $show_search = true, $show_email = false ) {570 function display( $show_search = true, $show_email = false, $show_delete = false ) { 567 571 global $wp_roles; 568 572 569 573 $r = ''; … … 627 631 $r .= "</fieldset>\n"; 628 632 $r .= "</form>\n\n"; 629 633 } 634 635 if( $show_delete ) { 636 $bulk_actions = array( 637 'delete' => __( 'Delete' ), 638 ); 639 }else{ 640 $bulk_actions = array(); //for plugins 641 } 642 643 do_action_ref_array( 'bulk_user_actions', array( &$bulk_actions, &$bb_user_search ) ); 644 645 $r .= "<div class='clear'></div>\n\n"; 646 $r .= "<form class='table-form bulk-form' method='post' action=''>\n"; 647 $r .= "\t<fieldset>\n"; 648 $r .= "\t\t<select name='action'>\n"; 649 $r .= "\t\t\t<option>" . __( 'Bulk Actions' ) . "</option>\n"; 650 651 foreach ( $bulk_actions as $value => $label ) : 652 $r .= "\t\t\t<option value='" . esc_attr( $value ) . "'>" . esc_html( $label ) . "</option>\n"; 653 endforeach; 654 655 $r .= "\t\t</select>\n"; 656 $r .= "\t\t<input type='submit' value='" . esc_attr__( 'Apply' ) . "' class='button submit-input' />\n"; 657 $r .= "\t\t" . bb_nonce_field( 'user-bulk', '_wpnonce', true, false ) . "\n"; 658 $r .= "\t</fieldset>\n"; 630 659 631 660 if ( $this->get_results() ) { 632 661 if ( $this->results_are_paged() ) … … 641 670 $r .= "<table class='widefat'>\n"; 642 671 $r .= "<thead>\n"; 643 672 $r .= "\t<tr>\n"; 673 if ( $show_delete ) { 674 $r .= "\t\t<th scope='col' class='check-column'><input type='checkbox' /></th>\n"; 675 } 644 676 if ( $show_email ) { 645 677 $r .= "\t\t<th style='width:30%;'>" . __('Username') . "</th>\n"; 646 678 $r .= "\t\t<th style='width:20%;'>" . __('Name') . "</th>\n"; … … 655 687 $r .= "</thead>\n\n"; 656 688 $r .= "<tfoot>\n"; 657 689 $r .= "\t<tr>\n"; 690 if ( $show_delete ) { 691 $r .= "\t\t<th scope='col' class='check-column'><input type='checkbox' /></th>\n"; 692 } 658 693 if ( $show_email ) { 659 694 $r .= "\t\t<th style='width:30%;'>" . __('Username') . "</th>\n"; 660 695 $r .= "\t\t<th style='width:20%;'>" . __('Name') . "</th>\n"; … … 670 705 671 706 $r .= "<tbody id='role-$role'>\n"; 672 707 foreach ( (array) $this->get_results() as $user_object ) 673 $r .= bb_user_row($user_object, $role, $show_email );708 $r .= bb_user_row($user_object, $role, $show_email, $show_delete); 674 709 $r .= "</tbody>\n"; 675 710 $r .= "</table>\n\n"; 711 $r .= "</form>\n\n"; 676 712 //} 677 713 678 714 if ( $this->results_are_paged() )