LLMS_Admin_Post_Table_Courses::handle_bulk_actions( string $redirect_to, string $doaction, array $post_ids )
Exports courses from the Bulk Actions menu on the courses post table
Parameters Parameters
- $redirect_to
-
(string) (Required) url to redirect to upon export completion (not used)
- $doaction
-
(string) (Required) action name called
- $post_ids
-
(array) (Required) selected post ids
Return Return
(null)
Source Source
File: includes/admin/post-types/post-tables/class.llms.admin.post.table.courses.php
* @param array $post_ids selected post ids * @return null * @since 3.3.0 * @version 3.24.0 */ public function handle_bulk_actions( $redirect_to, $doaction, $post_ids ) { // Ensure it's our custom action. if ( 'llms_export' !== $doaction ) { return $redirect_to; } $data = array( '_generator' => 'LifterLMS/BulkCourseExporter', '_source' => get_site_url(), '_version' => llms()->version, 'courses' => array(), ); foreach ( $post_ids as $post_id ) { $c = new LLMS_Course( $post_id ); $data['courses'][] = $c->toArray(); } $title = str_replace( ' ', '-', __( 'courses export', 'lifterlms' ) ); $title = preg_replace( '/[^a-zA-Z0-9-]/', '', $title ); $filename = apply_filters( 'llms_bulk_export_courses_filename', $title . '_' . current_time( 'Ymd' ), $this ); header( 'Content-type: application/json' ); header( 'Content-Disposition: attachment; filename="' . $filename . '.json"' ); header( 'Pragma: no-cache' ); header( 'Expires: 0' );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |