ReportsGenerator::setupParams()

Setup ld activity query params

Description

Source

File: bp-integrations/learndash/library/ReportsGenerator.php

403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
    protected function setupParams()
    {
        // includes/ld-reports.php:882 learndash_reports_get_activity only allowd leader if group_id is passed
        // $this->params['group_ids'] = $this->args['group'];
        $ldGroupId = bp_ld_sync('buddypress')->sync->generator($this->args['group'])->getLdGroupId();
 
        if ($this->hasArg('date_format')) {
            $this->params['date_format'] = $this->args['date_format'] ?: 'Y-m-d';
        }
 
        $this->params['course_ids'] = learndash_group_enrolled_courses($ldGroupId);
 
        if ($this->hasArg('step')) {
            $this->params['post_types'] = $this->args['step'] == 'all'? $this->allSteps() : $this->args['step'];
        }
 
        // if ($this->hasArg('user')) {
            $this->params['user_ids'] = $this->args['user'] ?: learndash_get_groups_user_ids($ldGroupId);
        // }
 
        if ($this->hasArg('completed')) {
            $this->params['activity_status'] = $this->args['completed']? 'COMPLETED' : 'IN_PROGRESS';
        }
 
        if ($this->hasArg('order')) {
            $columns = $this->columns();
            $columnIndex = $this->args['order'][0]['column'];
            $column = $columns[$this->args['columns'][$columnIndex]['name']];
 
            $oldOrder = isset($this->params['orderby_order'])? ", {$this->params['orderby_order']}" : '';
            $this->params['orderby_order'] = "{$column['order_key']} {$this->args['order'][0]['dir']} {$oldOrder}";
        }
 
        if ($this->hasArg('start')) {
            $this->params['paged'] = $this->args['start'] / $this->args['length'] + 1;
        }
 
        if ($this->hasArg('length')) {
            $this->params['per_page'] = $this->args['length'];
        }
// print_r($this->params);die();
        $this->params = apply_filters('bp_ld_sync/reports_generator_params', $this->params, $this->args);
    }

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.