BP_REST_Learndash_Courses_Endpoint::get_last_activity( WP_Post $post )

Get course Last Activity.

Description

Parameters

$post

(Required) Object of wp_post.

Return

(string)

Source

File: bp-integrations/learndash/classes/class-bp-rest-learndash-courses-endpoint.php

	public function get_last_activity( $post ) {
		$course_activity = learndash_get_user_activity(
			array(
				'course_id'     => $post->ID,
				'user_id'       => get_current_user_id(),
				'post_id'       => $post->ID,
				'activity_type' => 'course',
			)
		);

		if ( $course_activity ) {
			return sprintf(
			// translators: Last activity date in infobar.
				esc_html_x( 'Last activity on %s', 'Last activity date in infobar', 'buddyboss' ),
				learndash_adjust_date_time_display( $course_activity->activity_updated, get_option( 'date_format' ) )
			);
		}

		return '';
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.