Ajax::ajaxGetReports()

Get reports

Description

Source

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

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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.