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/Models/UserItems/UserItemModel.php +61 -1 4.4.14.4.8 View file →
@@ -450,11 +450,16 @@
450 450 if ( $user_item_id_new ) {
451 451 $this->set_user_item_id( $user_item_id_new );
452 452 }
453 453
454 - // Clear caches.
454 + // Clear caches before firing the created hook. Webhook and third-party listeners may reload
455 + // this user item from the model/cache layer, so firing earlier can expose stale data.
455 456 $this->clean_caches();
456 457
458 + if ( $user_item_id_new ) {
459 + do_action( 'learn-press/user-item/created', $this );
460 + }
461 +
457 462 return $this;
458 463 }
459 464
460 465 /**
@@ -536,8 +541,63 @@
536 541 break;
537 542 }
538 543
539 544 return $value;
545 + }
546 +
547 + /**
548 + * Get status label.
549 + *
550 + * @return string
551 + * @since 4.4.2
552 + * @version 1.0.0
553 + */
554 + public function get_status_label(): string {
555 + switch ( $this->get_status() ) {
556 + case self::STATUS_COMPLETED:
557 + $value = __( 'Completed', 'learnpress' );
558 + break;
559 + case self::STATUS_FINISHED:
560 + $value = __( 'Finished', 'learnpress' );
561 + break;
562 + case self::STATUS_ENROLLED:
563 + $value = __( 'Enrolled', 'learnpress' );
564 + break;
565 + case self::STATUS_CANCEL:
566 + $value = __( 'Cancel', 'learnpress' );
567 + break;
568 + default:
569 + $value = $this->get_status();
570 + break;
571 + }
572 +
573 + return (string) $value;
574 + }
575 +
576 + /**
577 + * Get graduation label.
578 + *
579 + * @return string
580 + * @since 4.4.2
581 + * @version 1.0.0
582 + */
583 + public function get_graduation_label(): string {
584 + switch ( $this->get_graduation() ) {
585 + case self::GRADUATION_IN_PROGRESS:
586 + $value = __( 'In Progress', 'learnpress' );
587 + break;
588 + case self::GRADUATION_PASSED:
589 + $value = __( 'Passed', 'learnpress' );
590 + break;
591 + case self::GRADUATION_FAILED:
592 + $value = __( 'Failed', 'learnpress' );
593 + break;
594 + default:
595 + $value = $this->get_graduation();
596 + break;
597 + }
598 +
599 + return (string) $value;
540 600 }
541 601
542 602 /**
543 603 * Delete user item.