LLMS_Table_Memberships::get_data( string $key, mixed $data )

Retrieve data for a cell.


Parameters Parameters

$key

(string) (Required) The column id / key.

$data

(mixed) (Required) Object / array of data that the function can use to extract the data.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.memberships.php

	protected function get_data( $key, $data ) {

		$membership = llms_get_post( $data );

		switch ( $key ) {

			case 'id':
				$value = $this->get_post_link( $membership->get( 'id' ) );
				break;

			case 'instructors':
				$data = array();
				foreach ( $membership->get_instructors() as $info ) {
					$instructor = llms_get_instructor( $info['id'] );
					if ( $instructor ) {
						$data[] = sprintf( '%1$s (%2$s)', $instructor->get( 'display_name' ), $info['label'] );
					}
				}
				$value = implode( ', ', $data );
				break;

			case 'students':
				$value = number_format_i18n( $membership->get_student_count(), 0 );
				break;

			case 'title':
				$url   = LLMS_Admin_Reporting::get_current_tab_url(
					array(
						'tab'           => 'memberships',
						'membership_id' => $membership->get( 'id' ),
					)
				);
				$value = '<a href="' . esc_url( $url ) . '">' . $membership->get( 'title' ) . '</a>';
				break;

			default:
				$value = $key;

		}// End switch().

		return $value;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.32.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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