PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/admin/views/meta-boxes/fields/duration.php +6 -4 4.2.04.4.8 View file →
@@ -14,10 +14,10 @@
14 14 *
15 15 * @param string $id
16 16 * @param string $label
17 17 * @param string $description
18 - * @param mixed $default
19 - * @param array $extra
18 + * @param mixed $default
19 + * @param array $extra
20 20 */
21 21 public function __construct( $label = '', $description = '', $default = '', $extra = array() ) {
22 22 parent::__construct( $label, $description, $default, $extra );
23 23 }
@@ -89,10 +89,12 @@
89 89 public function save( $post_id ) {
90 90 $duration = learn_press_get_course_duration_support();
91 91 $duration_keys = array_keys( $duration );
92 92 $default_time = ! empty( $this->extra['default_time'] ) ? $this->extra['default_time'] : end( $duration_keys );
93 + $data = LP_Request::get_param( $this->id, [] );
94 + $duration = isset( $data[0] ) && $data[0] !== '' ? absint( $data[0] ) . ' ' . trim( $data[1] ) : absint( $this->default ) . ' ' . trim( $default_time );
93 95
94 - $duration = isset( $_POST[ $this->id ][0] ) && $_POST[ $this->id ][0] !== '' ? absint( wp_unslash( $_POST[ $this->id ][0] ) ) . ' ' . trim( wp_unslash( $_POST[ $this->id ][1] ) ) : absint( $this->default ) . ' ' . trim( $default_time );
96 + update_post_meta( $post_id, $this->id, $duration );
95 97
96 - update_post_meta( $post_id, $this->id, $duration );
98 + return $duration;
97 99 }
98 100 }