detect_instructor_by_page(); if ( ! $instructor instanceof UserModel ) { $instructor_id = (int) $settings['instructor_id'] ?? 0; $instructor = UserModel::find( $instructor_id, true ); } if ( ! $instructor ) { if ( Plugin::$instance->editor->is_edit_mode() ) { throw new Exception( $label_default ); } else { throw new Exception( __( 'Instructor not found!', 'learnpress' ) ); } } if ( ! $instructor->is_instructor() ) { throw new Exception( __( 'User is not Instructor!', 'learnpress' ) ); } } }