Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Admin_Builder::process_detachments( array $data )
Process lesson detachments from the heartbeat data
Description Description
Parameters Parameters
- $data
-
(array) (Required) array of lesson ids
Return Return
(array)
Source Source
File: includes/admin/class.llms.admin.builder.php
private static function process_detachments( $data ) { $ret = array(); foreach ( $data['detach'] as $id ) { $res = array( 'error' => sprintf( esc_html__( 'Unable to detach "%s". Invalid ID.', 'lifterlms' ), $id ), 'id' => $id, ); $type = get_post_type( $id ); $post_types = apply_filters( 'llms_builder_detachable_post_types', array( 'lesson', 'llms_question', 'llms_quiz' ) ); if ( ! is_numeric( $id ) || ! in_array( $type, $post_types ) ) { array_push( $ret, $res ); continue; } $post = llms_get_post( $id ); if ( ! is_a( $post, 'LLMS_Post_Model' ) ) { array_push( $ret, $res ); continue; } if ( 'lesson' === $type ) { $post->set( 'parent_course', '' ); $post->set( 'parent_section', '' ); } elseif ( 'llms_question' === $type ) { $post->set( 'parent_id', '' ); } elseif ( 'llms_quiz' === $type ) { $parent = $post->get_lesson(); if ( $parent ) { $parent->set( 'quiz_enabled', 'no' ); $parent->set( 'quiz', '' ); $post->set( 'lesson_id', 0 ); } } do_action( 'llms_builder_detach_' . $type, $post ); unset( $res['error'] ); array_push( $ret, $res ); }// End foreach(). return $ret; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: