diff --git a/CHANGELOG.md b/CHANGELOG.md index 467d35c..310ce4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ LifterLMS Labs Changelog ======================== +v1.8.0 - 2023-11-02 +------------------- + +##### New Features + ++ Added settings for the lessons favorite button visibility. + +##### Developer Notes + ++ Changed priority of the action manager settings loading. + + v1.7.0 - 2023-10-26 ------------------- diff --git a/i18n/lifterlms-labs.pot b/i18n/lifterlms-labs.pot index 1e11b8f..2b88191 100644 --- a/i18n/lifterlms-labs.pot +++ b/i18n/lifterlms-labs.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPLv3. msgid "" msgstr "" -"Project-Id-Version: LifterLMS Labs 1.7.0\n" +"Project-Id-Version: LifterLMS Labs 1.8.0\n" "Report-Msgid-Bugs-To: https://lifterlms.com/my-account/my-tickets\n" "Last-Translator: Team LifterLMS \n" "Language-Team: Team LifterLMS \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-10-26T15:19:01+00:00\n" +"POT-Creation-Date: 2023-11-02T09:31:27+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: llms/dev 0.2.0\n" "X-Domain: lifterlms-labs\n" @@ -121,17 +121,17 @@ msgstr "" msgid "Check the box next to each action that should be removed." msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:154 +#: inc/labs/class.llms.lab.action.manager.php:155 msgid "Single Course Actions" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:159 -#: inc/labs/class.llms.lab.action.manager.php:245 +#: inc/labs/class.llms.lab.action.manager.php:160 +#: inc/labs/class.llms.lab.action.manager.php:260 msgid "Video Embed" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:164 -#: inc/labs/class.llms.lab.action.manager.php:250 +#: inc/labs/class.llms.lab.action.manager.php:165 +#: inc/labs/class.llms.lab.action.manager.php:265 msgid "Audio Embed" msgstr "" @@ -189,50 +189,62 @@ msgid "Reviews" msgstr "" #: inc/labs/class.llms.lab.action.manager.php:235 -msgid "Single Lesson Actions" +msgid "Course Syllabus Actions" msgstr "" #: inc/labs/class.llms.lab.action.manager.php:240 +msgid "Mark Favorite / Unfavorite Lesson button on Lesson preview" +msgstr "" + +#: inc/labs/class.llms.lab.action.manager.php:245 +msgid "Single Lesson Actions" +msgstr "" + +#: inc/labs/class.llms.lab.action.manager.php:250 msgid "Back to Course Link" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:256 +#: inc/labs/class.llms.lab.action.manager.php:255 +msgid "Mark Favorite / Unfavorite Lesson button" +msgstr "" + +#: inc/labs/class.llms.lab.action.manager.php:271 msgid "Mark Complete / Mark Incomplete / Take Quiz Button(s)" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:261 +#: inc/labs/class.llms.lab.action.manager.php:276 msgid "Course Navigation Tiles" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:266 +#: inc/labs/class.llms.lab.action.manager.php:281 msgid "Course and Membership Catalogs" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:271 +#: inc/labs/class.llms.lab.action.manager.php:286 msgid "Featured Video" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:276 +#: inc/labs/class.llms.lab.action.manager.php:291 msgid "Featured Image" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:281 +#: inc/labs/class.llms.lab.action.manager.php:296 msgid "Progress Bar" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:286 +#: inc/labs/class.llms.lab.action.manager.php:301 msgid "Author" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:291 +#: inc/labs/class.llms.lab.action.manager.php:306 msgid "Length" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:296 +#: inc/labs/class.llms.lab.action.manager.php:311 msgid "Difficulty" msgstr "" -#: inc/labs/class.llms.lab.action.manager.php:301 +#: inc/labs/class.llms.lab.action.manager.php:316 msgid "Lesson Count" msgstr "" diff --git a/inc/labs/class.llms.lab.action.manager.php b/inc/labs/class.llms.lab.action.manager.php index 25c3457..23a3db4 100644 --- a/inc/labs/class.llms.lab.action.manager.php +++ b/inc/labs/class.llms.lab.action.manager.php @@ -5,7 +5,7 @@ * @package LifterLMS_Labs/Labs/Classes * * @since 1.2.0 - * @version 1.7.0 + * @version 1.8.0 */ defined( 'ABSPATH' ) || exit; @@ -52,14 +52,14 @@ protected function configure() { * Initialize the Lab. * * @since 1.2.0 + * @since 1.8.0 Postpone settings creation and actions removal. * * @return void */ protected function init() { - $this->setup_hooks(); - - add_action( 'plugins_loaded', array( $this, 'remove_actions' ), 777 ); + add_action( 'init', array( $this, 'setup_hooks' ), 11 ); + add_action( 'init', array( $this, 'remove_actions' ), 11 ); } @@ -149,6 +149,7 @@ public function settings() { * @return void */ public function setup_hooks() { + $this->hooks = array( array( 'title' => esc_html__( 'Single Course Actions', 'lifterlms-labs' ), @@ -163,7 +164,6 @@ public function setup_hooks() { 'priority' => 30, 'title' => esc_html__( 'Audio Embed', 'lifterlms-labs' ), ), - 'lifterlms_template_single_meta_wrapper_start' => array( 'action' => 'lifterlms_single_course_after_summary', 'priority' => 5, @@ -231,6 +231,16 @@ public function setup_hooks() { ), ), ), + array( + 'title' => esc_html__( 'Course Syllabus Actions', 'lifterlms-labs' ), + 'actions' => array( + 'llms_template_syllabus_favorite_lesson_preview' => array( + 'action' => 'llms_lesson_preview_after_title', + 'priority' => 10, + 'title' => esc_html__( 'Mark Favorite / Unfavorite Lesson button on Lesson preview', 'lifterlms-labs' ), + ), + ), + ), array( 'title' => esc_html__( 'Single Lesson Actions', 'lifterlms-labs' ), 'actions' => array( @@ -239,6 +249,11 @@ public function setup_hooks() { 'priority' => 10, 'title' => esc_html__( 'Back to Course Link', 'lifterlms-labs' ), ), + 'llms_template_favorite' => array( + 'action' => 'lifterlms_single_lesson_before_summary', + 'priority' => 10, + 'title' => esc_html__( 'Mark Favorite / Unfavorite Lesson button', 'lifterlms-labs' ), + ), 'lifterlms_template_single_lesson_video' => array( 'action' => 'lifterlms_single_lesson_before_summary', 'priority' => 20, @@ -309,6 +324,13 @@ public function setup_hooks() { unset( $this->hooks[ count( $this->hooks ) - 1 ]['actions']['lifterlms_template_loop_lesson_count'] ); } + // Remove setting when the favorites feature is disabled. + if ( ! function_exists( 'llms_is_favorites_enabled' ) || ! llms_is_favorites_enabled() ) { + unset( + $this->hooks[1], // Unset the whole Course Syllabus section since it only contains the favorite setting. + $this->hooks[2]['actions']['llms_template_favorite'] + ); + } } } diff --git a/lifterlms-labs.php b/lifterlms-labs.php index 27809f1..e1a8cc8 100644 --- a/lifterlms-labs.php +++ b/lifterlms-labs.php @@ -10,7 +10,7 @@ * Plugin Name: LifterLMS Labs * Plugin URI: https://lifterlms.com/ * Description: Experimental, conceptual, and possibly silly new features to improve and enhance the functionality of the LifterLMS core - * Version: 1.7.0 + * Version: 1.8.0 * Author: LifterLMS * Author URI: https://lifterlms.com * Text Domain: lifterlms-labs @@ -35,7 +35,7 @@ final class LifterLMS_Labs { * * @var string */ - public $version = '1.7.0'; + public $version = '1.8.0'; /** * Singleton Instance. diff --git a/package-lock.json b/package-lock.json index 328816b..8efb751 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lifterlms-labs", - "version": "1.7.0", + "version": "1.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lifterlms-labs", - "version": "1.7.0", + "version": "1.8.0", "license": "GPL-3.0", "devDependencies": { "@lifterlms/dev": "^0.2.0", diff --git a/package.json b/package.json index 5e79fcb..e37515a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lifterlms-labs", - "version": "1.7.0", + "version": "1.8.0", "description": "Experimental, conceptual, and possibly silly new features to improve and enhance the functionality of the LifterLMS core", "repository": { "type": "git",