BP_Members_List_Table
列出注册管理页面的表类。
描述
源
文件:bp-members /类/ class-bp-members-list-table.php
class bp_members_list_table扩展wp_users_list_table {/ ** *注册计数。* * @since buddypress 2.0.0 * * * @var int * / public $ signup_counts = 0;/ ** *构造函数。* * @since buddypress 2.0.0 * / public function __construct(){//定义奇异和复数标签,以及我们是否支持ajax。父级:: __构造(array('ajax'=> false,'复数'=>'注册','singular'=>'注册','屏幕'=> get_current_screen() - > id,));} / ** *设置列表表中显示的项目。* *处理在渲染前所需的数据,排序,分页和任何其他数据*操纵的过滤。* * @since buddypress 2.0.0 * / public function prefign_items(){global $ useurearch;$ usersearch = isset($ _request ['s'])?$ _request ['']:''; $signups_per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) ); $paged = $this->get_pagenum(); $args = array( 'offset' => ( $paged - 1 ) * $signups_per_page, 'number' => $signups_per_page, 'usersearch' => $usersearch, 'orderby' => 'signup_id', 'order' => 'DESC' ); if ( isset( $_REQUEST['orderby'] ) ) { $args['orderby'] = $_REQUEST['orderby']; } if ( isset( $_REQUEST['order'] ) ) { $args['order'] = $_REQUEST['order']; } $signups = BP_Signup::get( $args ); $this->items = $signups['signups']; $this->signup_counts = $signups['total']; $this->set_pagination_args( array( 'total_items' => $this->signup_counts, 'per_page' => $signups_per_page, ) ); } /** * Display the users screen views * * @since BuddyPress 2.5.0 * * @global string $role The name of role the users screens is filtered by */ public function views() { global $role; // Used to reset the role. $reset_role = $role; // Temporarly set the role to registered. $role = 'registered'; // Used to reset the screen id once views are displayed. $reset_screen_id = $this->screen->id; // Temporarly set the screen id to the users one. $this->screen->id = 'users'; // Use the parent function so that other plugins can safely add views. parent::views(); // Reset the role. $role = $reset_role; // Reset the screen id. $this->screen->id = $reset_screen_id; } /** * Get rid of the extra nav. * * WP_Users_List_Table will add an extra nav to change user's role. * As we're dealing with signups, we don't need this. * * @since BuddyPress 2.0.0 * * @param array $which Current table nav item. */ public function extra_tablenav( $which ) { return; } /** * Specific signups columns. * * @since BuddyPress 2.0.0 * * @return array */ public function get_columns() { /** * Filters the single site Members signup columns. * * @since BuddyPress 2.0.0 * * @param array $value Array of columns to display. */ return apply_filters( 'bp_members_signup_columns', array( 'cb' => '', 'username' => __( 'Username', 'buddyboss' ), 'name' => __( 'Name', 'buddyboss' ), 'email' => __( 'Email', 'buddyboss' ), 'registered' => __( 'Registered', 'buddyboss' ), 'date_sent' => __( 'Last Sent', 'buddyboss' ), 'count_sent' => __( 'Emails Sent', 'buddyboss' ) ) ); } /** * Specific bulk actions for signups. * * @since BuddyPress 2.0.0 */ public function get_bulk_actions() { $actions = array( 'activate' => __( 'Activate', 'buddyboss' ), 'resend' => __( 'Email', 'buddyboss' ), ); if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = __( 'Delete', 'buddyboss' ); } return $actions; } /** * The text shown when no items are found. * * Nice job, clean sheet! * * @since BuddyPress 2.0.0 */ public function no_items() { if ( bp_get_signup_allowed() ) { esc_html_e( 'No pending accounts found.', 'buddyboss' ); } else { $link = false; // Specific case when BuddyPress is not network activated. if ( is_multisite() && current_user_can( 'manage_network_users') ) { $link = sprintf( '%2$s', esc_url( network_admin_url( 'settings.php' ) ), esc_html__( 'Edit settings', 'buddyboss' ) ); } elseif ( current_user_can( 'manage_options' ) ) { $link = sprintf( '%2$s', esc_url( bp_get_admin_url( 'options-general.php' ) ), esc_html__( 'Edit settings', 'buddyboss' ) ); } printf( __( 'Registration is disabled. %s', 'buddyboss' ), $link ); } } /** * The columns signups can be reordered with. * * @since BuddyPress 2.0.0 */ public function get_sortable_columns() { return array( 'username' => 'login', 'email' => 'email', 'registered' => 'signup_id', ); } /** * Display signups rows. * * @since BuddyPress 2.0.0 */ public function display_rows() { $style = ''; foreach ( $this->items as $userid => $signup_object ) { // Avoid a notice error appearing since 4.3.0. if ( isset( $signup_object->id ) ) { $signup_object->ID = $signup_object->id; } $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; echo "\n\t" . $this->single_row( $signup_object, $style ); } } /** * Display a signup row. * * @since BuddyPress 2.0.0 * * @see WP_List_Table::single_row() for explanation of params. * * @param object|null $signup_object Signup user object. * @param string $style Styles for the row. * @param string $role Role to be assigned to user. * @param int $numposts Numper of posts. * @return void */ public function single_row( $signup_object = null, $style = '', $role = '', $numposts = 0 ) { echo ''; echo $this->single_row_columns( $signup_object ); echo ' '; } /** * Markup for the checkbox used to select items for bulk actions. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object The signup data object. */ public function column_cb( $signup_object = null ) { ?> user_email, 32 ); // Activation email link. $email_link = add_query_arg( array( 'page' => 'bp-signups', 'signup_id' => $signup_object->id, 'action' => 'resend', ), bp_get_admin_url( 'users.php' ) ); // Activate link. $activate_link = add_query_arg( array( 'page' => 'bp-signups', 'signup_id' => $signup_object->id, 'action' => 'activate', ), bp_get_admin_url( 'users.php' ) ); // Delete link. $delete_link = add_query_arg( array( 'page' => 'bp-signups', 'signup_id' => $signup_object->id, 'action' => 'delete', ), bp_get_admin_url( 'users.php' ) ); echo $avatar . sprintf( '%2$s
', esc_url( $activate_link ), $signup_object->user_login ); $actions = array(); $actions['activate'] = sprintf( '%2$s', esc_url( $activate_link ), __( 'Activate', 'buddyboss' ) ); $actions['resend'] = sprintf( '%2$s', esc_url( $email_link ), __( 'Email', 'buddyboss' ) ); if ( current_user_can( 'delete_users' ) ) { $actions['delete'] = sprintf( '%2$s', esc_url( $delete_link ), __( 'Delete', 'buddyboss' ) ); } /** * Filters the multisite row actions for each user in list. * * @since BuddyPress 2.0.0 * * @param array $actions Array of actions and corresponding links. * @param object $signup_object The signup data object. */ $actions = apply_filters( 'bp_members_ms_signup_row_actions', $actions, $signup_object ); echo $this->row_actions( $actions ); } /** * Display user name, if any. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object The signup data object. */ public function column_name( $signup_object = null ) { echo esc_html( $signup_object->user_name ); } /** * Display user email. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object The signup data object. */ public function column_email( $signup_object = null ) { printf( '%2$s', esc_attr( $signup_object->user_email ), esc_html( $signup_object->user_email ) ); } /** * Display registration date. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object The signup data object. */ public function column_registered( $signup_object = null ) { echo mysql2date( 'Y/m/d', $signup_object->registered ); } /** * Display the last time an activation email has been sent. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object The signup data object. */ public function column_date_sent( $signup_object = null ) { echo mysql2date( 'Y/m/d', $signup_object->date_sent ); } /** * Display number of time an activation email has been sent. * * @since BuddyPress 2.0.0 * * @param object|null $signup_object Signup object instance. */ public function column_count_sent( $signup_object = null ) { echo absint( $signup_object->count_sent ); } /** * Allow plugins to add their custom column. * * @since BuddyPress 2.1.0 * * @param object|null $signup_object The signup data object. * @param string $column_name The column name. * @return string */ function column_default( $signup_object = null, $column_name = '' ) { /** * Filters the single site custom columns for plugins. * * @since BuddyPress 2.1.0 * * @param string $column_name The column name. * @param object $signup_object The signup data object. */ return apply_filters( 'bp_members_signup_custom_column', '', $column_name, $signup_object ); } }
更新日志
版本 | 描述 |
---|---|
BuddyPress 2.0.0 | 介绍了。 |
方法
- __construct——构造函数。
- column_cb-用于为批量操作选择项目的复选框的标记。
- column_count_sent-显示激活邮件发送的时间。
- column_date_sent—显示最近一次发送激活邮件的时间。
- column_default允许插件添加自定义列。
- column_email—显示用户邮箱。
- column_name—如果存在用户名,则显示用户名。
- column_registered-显示注册日期。
- column_username—行操作(删除/激活/电子邮件)。
- display_rows—显示注册行。
- extra_tablenav-去掉多余的导航。
- get_bulk_actions-注册的具体批量操作。
- get_columns-特定的注册列。
- get_sortable_columns-列注册可以重新排序。
- no_items-没有找到项目时显示的文本。
- prepare_items-设置列表表中显示的项目。
- single_row—显示注册行。
- 的观点—显示用户界面视图