LLMS_Table_Membership_Students::get_data( string $key, LLMS_Student $student )

Retrieve data for the columns


Parameters Parameters

$key

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

$student

(LLMS_Student) (Required) Student object.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.membership.students.php

	public function get_data( $key, $student ) {

		$value = '';

		switch ( $key ) {

			case 'enrolled':
				$value = $student->get_enrollment_date( $this->membership_id, 'updated' );
				break;

			case 'id':
				$id = $student->get_id();
				if ( current_user_can( 'edit_users', $id ) ) {
					$value = '<a href="' . esc_url( get_edit_user_link( $id ) ) . '">' . $id . '</a>';
				} else {
					$value = $id;
				}
				break;

			case 'name':
				$first = $student->get( 'first_name' );
				$last  = $student->get( 'last_name' );

				if ( ! $first || ! $last ) {
					$value = $student->get( 'display_name' );
				} else {
					$value = $last . ', ' . $first;
				}

				$url   = add_query_arg(
					array(
						'page'          => 'llms-reporting',
						'tab'           => 'students',
						'student_id'    => $student->get_id(),
						'stab'          => 'memberships',
						'membership_id' => $this->membership_id,
					),
					admin_url( 'admin.php' )
				);
				$value = '<a href="' . esc_url( $url ) . '">' . $value . '</a>';

				break;

			case 'status':
				$value = llms_get_enrollment_status_name( $student->get_enrollment_status( $this->membership_id ) );
				break;

			default:
				$value = $key;

		}// End switch().

		return $this->filter_get_data( $value, $key, $student );

	}


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.