Ajax::ajaxGetReports()

Get reports

Description

Source

File: bp-integrations/learndash/buddypress/Ajax.php

	public function ajaxGetReports()
	{
		$this->enableDebugOnDev();
		$this->validateRequest();

		$generator = $this->getGenerator();

		/**
		 * Hook before the data is fetched, in cause of overwriting the post value
		 *
		 * @since BuddyBoss 1.0.0
		 */
		do_action('bp_ld_sync/ajax/pre_fetch_reports', $generator);

		$generator->fetch();

		/**
		 * Hook after the data is fetched, in cause of overwriting results value
		 *
		 * @since BuddyBoss 1.0.0
		 */
		do_action('bp_ld_sync/ajax/post_fetch_reports', $generator);

		echo json_encode([
			'draw'            => (int) bp_ld_sync()->getRequest('draw'),
			'recordsTotal'    => $generator->getPager()['total_items'],
			'recordsFiltered' => $generator->getPager()['total_items'],
			'data'            => $generator->getData(),
		]);

		header('Content-Type: application/json; charset=' . get_option('blog_charset'));
		wp_die();
		// wp_send_json_success([
		// 	'draw' => (int) bp_ld_sync()->getRequest('draw'),
		// 'results' => $generator->getData(),
		// 'pager'   => $generator->getPager(),
		// ]);
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

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.