BP_Members_Admin::users_table_populate_type_cell( string $retval = '', string $column_name = '', int $user_id )

Return member’s type for display in the WP admin users list table.


Parameters Parameters

$retval

(string) (Optional)

Default value: ''

$column_name

(string) (Optional)

Default value: ''

$user_id

(int) (Required)


Top ↑

Return Return

(string) Member type as a link to filter all users.


Source Source

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

	public function users_table_populate_type_cell( $retval = '', $column_name = '', $user_id = 0 ) {
		// Only looking for member type column.
		if ( bp_get_member_type_tax_name() !== $column_name ) {
			return $retval;
		}

		// Get the member type.
		$member_type = bp_get_member_type( $user_id, false );

		// Build the Output.
		if ( $member_type ) {
			$member_types = array_filter( array_map( 'bp_get_member_type_object', $member_type ) );
			if ( ! $member_types ) {
				return $retval;
			}

			$type_links = array();
			foreach ( $member_types as $type ) {
				$url          = add_query_arg( array( 'bp-member-type' => urlencode( $type->name ) ) );
				$type_links[] = sprintf(
					'<a href="%1$s">%2$s</a>',
					esc_url( $url ),
					esc_html( $type->labels['singular_name'] )
				);
			}

			$retval = implode( ', ', $type_links );
		}

		return $retval;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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