Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

BP_Members_Admin::setup_actions()

Set admin-related actions and filters.


Source Source

File: bp-members/classes/class-bp-members-admin.php

	private function setup_actions() {

		/** Extended Profile *************************************************
		 */

		// Enqueue all admin JS and CSS.
		add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts'   )        );

		// Add some page specific output to the <head>.
		add_action( 'bp_admin_head',            array( $this, 'admin_head'        ), 999   );

		// Add menu item to all users menu.
		add_action( 'admin_menu',               array( $this, 'admin_menus'       ), 5     );
		add_action( 'network_admin_menu',       array( $this, 'admin_menus'       ), 5     );
		add_action( 'user_admin_menu',          array( $this, 'user_profile_menu' ), 5     );

		// Create the Profile Navigation (Profile/Extended Profile).
		add_action( 'edit_user_profile',        array( $this, 'profile_nav'       ), 99, 1 );
		add_action( 'show_user_profile',        array( $this, 'profile_nav'       ), 99, 1 );

		// Editing users of a specific site.
		add_action( "admin_head-site-users.php", array( $this, 'profile_admin_head' ) );

		// Add a row action to users listing.
		if ( bp_core_do_network_admin() ) {
			add_filter( 'ms_user_row_actions',        array( $this, 'row_actions'                    ), 10, 2 );
			add_action( 'admin_init',                 array( $this, 'add_edit_profile_url_filter'    )        );
			add_action( 'wp_after_admin_bar_render',  array( $this, 'remove_edit_profile_url_filter' )        );
		}

		// Add user row actions for single site.
		add_filter( 'user_row_actions', array( $this, 'row_actions' ), 10, 2 );

		// Process changes to member type.
		add_action( 'bp_members_admin_load', array( $this, 'process_member_type_update' ) );

		/** Signups **********************************************************
		 */

		if ( is_admin() ) {

			// Filter non multisite user query to remove sign-up users.
			if ( ! is_multisite() ) {
				add_action( 'pre_user_query', array( $this, 'remove_signups_from_user_query' ), 10, 1 );
			}

			// Reorganise the views navigation in users.php and signups page.
			if ( current_user_can( $this->capability ) ) {
				$user_screen = $this->users_screen;

				/**
				 * Users screen on multiblog is users, but signups
				 * need to be managed in the network for this case
				 */
				if ( bp_is_network_activated() && bp_is_multiblog_mode() && false === strpos( $user_screen, '-network' ) ) {
					$user_screen .= '-network';
				}

				add_filter( "views_{$user_screen}", array( $this, 'signup_filter_view'    ), 10, 1 );
				add_filter( 'set-screen-option',    array( $this, 'signup_screen_options' ), 10, 3 );
			}

			// Registration is turned on.
			add_action( 'update_site_option_registration',  array( $this, 'multisite_registration_on' ),   10, 2 );
			add_action( 'update_option_users_can_register', array( $this, 'single_site_registration_on' ), 10, 2 );

			// Member invitations are enabled.
			if ( bp_is_network_activated() ) {
				add_action( 'update_site_option_bp-enable-members-invitations', array( $this, 'multisite_registration_on' ), 10, 2 );
			} else {
				add_action( 'update_option_bp-enable-members-invitations', array( $this, 'single_site_registration_on' ), 10, 2 );
			}
		}

		/** Users List - Members Types ***************************************
		 */

		if ( is_admin() && bp_get_member_types() ) {

			// Add "Change type" <select> to WP admin users list table and process bulk members type changes.
			add_action( 'restrict_manage_users', array( $this, 'users_table_output_type_change_select' ) );
			add_action( 'load-users.php',        array( $this, 'users_table_process_bulk_type_change'  ) );

			// Add the member type column to the WP admin users list table.
			add_filter( 'manage_users_columns',       array( $this, 'users_table_add_type_column'    )        );
			add_filter( 'manage_users_custom_column', array( $this, 'users_table_populate_type_cell' ), 10, 3 );

			// Filter WP admin users list table to include users of the specified type.
			add_filter( 'pre_get_users', array( $this, 'users_table_filter_by_type' ) );
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.