Reports::removePointsColumnIfNotAssigned( $columns, $args )
Remove the points column if all courses doesn’t have points
Description
Source
File: bp-integrations/learndash/buddypress/Reports.php
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | public function removePointsColumnIfNotAssigned( $columns , $args ) { $shouldRemove = false; if ( $args [ 'course' ]) { $shouldRemove = '' === get_post_meta( $args [ 'course' ], 'course_points' , true); } else { $groupCourses = bp_ld_sync( 'buddypress' )->courses->getGroupCourses( $args [ 'group' ]); $shouldRemove = array_sum ( array_map ( function ( $course ) use ( $args ) { return get_post_meta( $args [ 'course' ], 'course_points' , true) ?: 0; }, $groupCourses )) > 0; } if (! in_array( $args [ 'step' ], [ 'all' , learndash_get_post_type_slug( 'course' )])) { unset( $columns [ 'points' ]); } if ( $shouldRemove ) { unset( $columns [ 'points' ]); } return $columns ; } |
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.