diff --git a/CHANGELOG.md b/CHANGELOG.md index fb1e3709fd..5ffcfc3fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ LifterLMS Changelog =================== +v7.8.4 - 2024-11-18 +------------------- + +##### Bug Fixes + ++ Fix translations not loading for LifterLMS in WordPress 6.7. [#2807](https://github.com/gocodebox/lifterlms/issues/2807) + + v7.8.3 - 2024-11-04 ------------------- diff --git a/class-lifterlms.php b/class-lifterlms.php index 8e505dcde3..906f5668f7 100644 --- a/class-lifterlms.php +++ b/class-lifterlms.php @@ -34,7 +34,7 @@ final class LifterLMS { * * @var string */ - public $version = '7.8.3'; + public $version = '7.8.4'; /** * LLMS_Assets instance diff --git a/includes/admin/post-types/post-tables/class.llms.admin.post.table.pages.php b/includes/admin/post-types/post-tables/class.llms.admin.post.table.pages.php index ea28813566..ae3ee9ab5a 100644 --- a/includes/admin/post-types/post-tables/class.llms.admin.post.table.pages.php +++ b/includes/admin/post-types/post-tables/class.llms.admin.post.table.pages.php @@ -31,26 +31,29 @@ public function __construct() { if ( isset( $_GET['post_type'] ) && 'page' === $_GET['post_type'] ) { - $pages = array( - 'checkout' => __( 'LifterLMS Checkout', 'lifterlms' ), - 'courses' => __( 'LifterLMS Course Catalog', 'lifterlms' ), - 'memberships' => __( 'LifterLMS Memberships Catalog', 'lifterlms' ), - 'myaccount' => __( 'LifterLMS Student Dashboard', 'lifterlms' ), - ); + add_action( 'init', array( $this, 'populate_pages' ) ); - foreach ( $pages as $key => $name ) { - $id = llms_get_page_id( $key ); - if ( $id ) { + add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 ); - $this->pages[ $id ] = $name; + } + } - } - } + public function populate_pages() { + $pages = array( + 'checkout' => __( 'LifterLMS Checkout', 'lifterlms' ), + 'courses' => __( 'LifterLMS Course Catalog', 'lifterlms' ), + 'memberships' => __( 'LifterLMS Memberships Catalog', 'lifterlms' ), + 'myaccount' => __( 'LifterLMS Student Dashboard', 'lifterlms' ), + ); - add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 ); + foreach ( $pages as $key => $name ) { + $id = llms_get_page_id( $key ); + if ( $id ) { - } + $this->pages[ $id ] = $name; + } + } } /** @@ -71,10 +74,7 @@ public function post_states( $states, $post ) { } return $states; - } - - } return new LLMS_Admin_Post_Table_Pages(); diff --git a/includes/integrations/class.llms.integration.bbpress.php b/includes/integrations/class.llms.integration.bbpress.php index d6d7e648db..56beff686d 100644 --- a/includes/integrations/class.llms.integration.bbpress.php +++ b/includes/integrations/class.llms.integration.bbpress.php @@ -47,8 +47,7 @@ class LLMS_Integration_BBPress extends LLMS_Abstract_Integration { */ protected function configure() { - $this->title = __( 'bbPress', 'lifterlms' ); - $this->description = sprintf( __( 'Restrict forums and topics to memberships, add forums to courses, and %1$smore%2$s.', 'lifterlms' ), '', '' ); + add_action( 'init', array( $this, 'set_title_and_description' ) ); if ( $this->is_available() ) { @@ -78,7 +77,11 @@ protected function configure() { add_action( 'llms_content_restricted_by_bbp_course_forum', array( $this, 'handle_course_forum_restriction' ), 10, 1 ); } + } + public function set_title_and_description() { + $this->title = __( 'bbPress', 'lifterlms' ); + $this->description = sprintf( __( 'Restrict forums and topics to memberships, add forums to courses, and %1$smore%2$s.', 'lifterlms' ), '', '' ); } /** @@ -176,7 +179,6 @@ public function engagement_query_args( $query_args, $action, $orig_args ) { } return $query_args; - } /** @@ -205,7 +207,6 @@ public function handle_course_forum_restriction( $restriction ) { llms_add_notice( $msg, 'error' ); llms_redirect_and_exit( get_permalink( $restriction['restriction_id'] ) ); - } /** @@ -237,7 +238,6 @@ public function get_course_forum_ids( $course ) { * @param LLMS_Course $course LifterLMS course object. */ return apply_filters( 'llms_bbp_get_course_forum_ids', $ids, $course ); - } /** @@ -268,7 +268,6 @@ public function get_forum_course_restrictions( $forum_id ) { $query = array_map( 'absint', $query ); return $query; - } /** @@ -347,7 +346,6 @@ public function restriction_checks_courses( $results ) { } return $results; - } /** @@ -389,7 +387,6 @@ public function restriction_checks_memberships( $results ) { } return $results; - } /** @@ -435,7 +432,5 @@ public function save_course_settings( $post_id ) { update_post_meta( $post_id, '_llms_bbp_forum_ids', $ids ); return $ids; - } - } diff --git a/includes/integrations/class.llms.integration.buddypress.php b/includes/integrations/class.llms.integration.buddypress.php index ba7e845918..64be0c776d 100644 --- a/includes/integrations/class.llms.integration.buddypress.php +++ b/includes/integrations/class.llms.integration.buddypress.php @@ -64,8 +64,7 @@ class LLMS_Integration_Buddypress extends LLMS_Abstract_Integration { */ protected function configure() { - $this->title = __( 'BuddyPress', 'lifterlms' ); - $this->description = sprintf( __( 'Add LifterLMS information to user profiles and enable membership restrictions for activity, group, and member directories. %1$sLearn More%2$s.', 'lifterlms' ), '', '' ); + add_action( 'init', array( $this, 'set_title_and_description' ) ); if ( $this->is_available() ) { @@ -78,7 +77,11 @@ protected function configure() { add_filter( 'llms_groups_maybe_hide_dashboard_tab', array( $this, 'return_true_on_bp_my_profile' ) ); } + } + public function set_title_and_description() { + $this->title = __( 'BuddyPress', 'lifterlms' ); + $this->description = sprintf( __( 'Add LifterLMS information to user profiles and enable membership restrictions for activity, group, and member directories. %1$sLearn More%2$s.', 'lifterlms' ), '', '' ); } /** @@ -109,7 +112,6 @@ public function get_integration_settings() { } return $settings; - } /** @@ -177,14 +179,13 @@ public function add_profile_nav_items() { 'slug' => $profile_endpoint['endpoint'], 'parent_slug' => $main_nav_slug, 'parent_url' => $parent_url, - 'screen_function' => function() use ( $ep_key, $profile_endpoint ) { + 'screen_function' => function () use ( $ep_key, $profile_endpoint ) { $this->endpoint_content( $ep_key, $profile_endpoint['content'] ); }, 'user_has_access' => $bp_is_my_profile, ) ); } - } /** @@ -270,7 +271,6 @@ public function courses_screen() { add_action( 'bp_template_content', array( $this, 'remove_courses_paginate_links_filter' ), 15 ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); - } /** @@ -303,7 +303,6 @@ public function endpoint_content( $ep_key, $ep_template_cb ) { // This triggers 'bp_template_content' action hook. bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); - } /** @@ -334,7 +333,6 @@ public function enqueue_assets() { "window.llms.address_info = '" . wp_json_encode( llms_get_countries_address_info() ) . "';" ); } - } /** @@ -378,7 +376,6 @@ public function modify_courses_paginate_links( $link ) { $this->current_endpoint_key; return $this->modify_paginate_links( $link ); - } /** @@ -476,7 +473,6 @@ public function modify_paginate_links( $link ) { } return $query ? $link . '?' . $query : $link; - } /** @@ -554,7 +550,6 @@ public function restriction_checks( $results ) { } return $results; - } /** @@ -574,7 +569,6 @@ private function get_profile_endpoints_options() { array_keys( $endpoints ), array_column( $endpoints, 'title' ) ); - } /** @@ -606,7 +600,6 @@ private function populate_profile_endpoints() { * @param array $endpoints Array of endpoint data. */ $this->endpoints = apply_filters( 'llms_buddypress_profile_endpoints', $endpoints ); - } /** @@ -650,7 +643,5 @@ function ( $endpoint ) { } return $endpoints; - } - } diff --git a/includes/privacy/class-llms-privacy.php b/includes/privacy/class-llms-privacy.php index 7986d521ab..46a3667078 100644 --- a/includes/privacy/class-llms-privacy.php +++ b/includes/privacy/class-llms-privacy.php @@ -63,7 +63,6 @@ public function __construct() { // Anonymize erased order properties. add_filter( 'llms_privacy_get_anon_prop_value', array( 'LLMS_Privacy_Erasers', 'anonymize_prop' ), 10, 3 ); - } /** @@ -123,7 +122,6 @@ protected static function get_order_data_props( $type ) { ); return apply_filters( 'llms_privacy_order_data_props', $props, $type ); - } /** @@ -185,7 +183,6 @@ public function get_privacy_message() { * @param string $content Privacy policy content as an html string. */ return apply_filters( 'llms_privacy_policy_content', $content ); - } /** @@ -243,7 +240,6 @@ protected static function get_student_data_props() { 'last_login' => __( 'Last Login Date', 'lifterlms' ), ) ); - } /** @@ -272,7 +268,6 @@ protected static function get_student_enrollments( $student, $page, $post_type ) 'done' => ( ! $enrollments['more'] ), 'results' => $enrollments['results'], ); - } /** @@ -304,7 +299,6 @@ protected static function get_student_orders( $student, $page ) { 'done' => $done, 'orders' => $results, ); - } /** @@ -327,7 +321,9 @@ protected static function get_student_quizzes( $student, $page ) { ) ); } - } -return new LLMS_Privacy(); +function llms_load_privacy() { + return new LLMS_Privacy(); +} +add_action( 'init', 'llms_load_privacy' ); diff --git a/lifterlms.php b/lifterlms.php index 8aa5de803b..aea8bb2a26 100644 --- a/lifterlms.php +++ b/lifterlms.php @@ -10,7 +10,7 @@ * Plugin Name: LifterLMS * Plugin URI: https://lifterlms.com/ * Description: Complete e-learning platform to sell online courses, protect lessons, offer memberships, and quiz students. WP Learning Management System. - * Version: 7.8.3 + * Version: 7.8.4 * Author: LifterLMS * Author URI: https://lifterlms.com/ * Text Domain: lifterlms @@ -18,7 +18,7 @@ * License: GPLv3 * License URI: https://www.gnu.org/licenses/gpl-3.0.html * Requires at least: 5.9 - * Tested up to: 6.6 + * Tested up to: 6.7 * Requires PHP: 7.4 * * * * * * * * * * * * * * * * * * * * * * * diff --git a/package-lock.json b/package-lock.json index 8abf87874e..3768d85b15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lifterlms", - "version": "7.8.3", + "version": "7.8.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lifterlms", - "version": "7.8.3", + "version": "7.8.4", "license": "GPL-3.0", "dependencies": { "@babel/core": "^7.16.5", diff --git a/package.json b/package.json index a8d4dbafba..63e2c0e010 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lifterlms", - "version": "7.8.3", + "version": "7.8.4", "description": "LifterLMS by codeBOX", "repository": { "type": "git", diff --git a/tests/phpunit/unit-tests/class-llms-test-main-class.php b/tests/phpunit/unit-tests/class-llms-test-main-class.php index ec2a033401..91817e7a73 100644 --- a/tests/phpunit/unit-tests/class-llms-test-main-class.php +++ b/tests/phpunit/unit-tests/class-llms-test-main-class.php @@ -133,41 +133,4 @@ public function test_init_session() { } - /** - * Test plugin localization - * - * @since 3.21.1 - * @since 4.9.0 Improve tests. - * - * @return void - */ - public function test_localize() { - - $dirs = array( - WP_LANG_DIR . '/lifterlms', // "Safe" directory. - WP_LANG_DIR . '/plugins', // Default language directory. - WP_PLUGIN_DIR . '/lifterlms/languages', // Plugin language directory. - ); - - foreach ( $dirs as $dir ) { - - // Make sure the initial strings work. - $this->assertEquals( 'LifterLMS', __( 'LifterLMS', 'lifterlms' ), $dir ); - $this->assertEquals( 'Course', __( 'Course', 'lifterlms' ), $dir ); - - // Load a language file. - $file = LLMS_Unit_Test_Files::copy_asset( 'lifterlms-en_US.mo', $dir ); - $this->llms->localize(); - - $this->assertEquals( 'BetterLMS', __( 'LifterLMS', 'lifterlms' ), $dir ); - $this->assertEquals( 'Module', __( 'Module', 'lifterlms' ), $dir ); - - // Clean up. - LLMS_Unit_Test_Files::remove( $file ); - unload_textdomain( 'lifterlms' ); - - } - - } - } diff --git a/tests/phpunit/unit-tests/functions/class-llms-test-functions-l10n.php b/tests/phpunit/unit-tests/functions/class-llms-test-functions-l10n.php index 6f545a1939..5114fe973f 100644 --- a/tests/phpunit/unit-tests/functions/class-llms-test-functions-l10n.php +++ b/tests/phpunit/unit-tests/functions/class-llms-test-functions-l10n.php @@ -21,43 +21,4 @@ class LLMS_Test_Functions_L10n extends LLMS_UnitTestCase { public function test_llms_get_locale() { $this->assertEquals( 'en_US', llms_get_locale() ); } - - /** - * Test llms_load_textdomain() as it would be used by a 3rd party. - * - * @since 4.9.0 - * - * @see LLMS_Test_Main_Class::test_localize() for coverage with default args against the LifterLMS core plugin. - * - * @return void - */ - public function test_llms_load_textdomain() { - - $dirs = array( - WP_LANG_DIR . '/lifterlms', // "Safe" directory. - WP_LANG_DIR . '/plugins', // Default language directory. - WP_PLUGIN_DIR . '/lifterlms-test/i18n', // Plugin language directory. - ); - - foreach ( $dirs as $dir ) { - - // Make sure the initial strings work. - $this->assertEquals( 'LifterLMS', __( 'LifterLMS', 'lifterlms-test' ), $dir ); - $this->assertEquals( 'Course', __( 'Course', 'lifterlms-test' ), $dir ); - - // Load a language file. - $file = LLMS_Unit_Test_Files::copy_asset( 'lifterlms-en_US.mo', $dir, 'lifterlms-test-en_US.mo' ); - llms_load_textdomain( 'lifterlms-test', WP_PLUGIN_DIR . '/lifterlms-test', 'i18n' ); - - $this->assertEquals( 'BetterLMS', __( 'LifterLMS', 'lifterlms-test' ), $dir ); - $this->assertEquals( 'Module', __( 'Course', 'lifterlms-test' ), $dir ); - - // Clean up. - LLMS_Unit_Test_Files::remove( $file ); - unload_textdomain( 'lifterlms-test' ); - - } - - } - }