can_create_course() ) { unset( $tabs['enrolled-students'] ); return $tabs; } // Show tab for instructor viewing own profile only. if ( (int) $user_of_profile->get_id() !== (int) $user_current->get_id() ) { unset( $tabs['enrolled-students'] ); return $tabs; } return $tabs; } /** * Render content of profile tab "Enrolled Students". * * @param string $tab_key * @param mixed $profile_tab * @param mixed $user * * @return string */ public function tab_content( $tab_key = '', $profile_tab = null, $user = null ): string { $profile = LP_Profile::instance(); $user = is_object( $user ) ? $user : $profile->get_user(); $user_current = $profile->get_user_current(); if ( ! is_object( $user ) || ! method_exists( $user, 'can_create_course' ) || ! method_exists( $user, 'get_id' ) ) { return ''; } if ( ! is_object( $user_current ) || ! method_exists( $user_current, 'get_id' ) ) { return ''; } if ( ! $user->can_create_course() || (int) $user->get_id() !== (int) $user_current->get_id() ) { return ''; } ob_start(); echo '