Skip to content

Commit

Permalink
Merge pull request #2722 from gocodebox/dev
Browse files Browse the repository at this point in the history
Release 7.7.2
  • Loading branch information
brianhogg committed Aug 12, 2024
2 parents 8518ff9 + bf16cbf commit eb3da8f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 139 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/test-e2e.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
LifterLMS Changelog
===================

v7.7.2 - 2024-08-12
-------------------

##### Bug Fixes

+ Fixes fatal error when updating from an old version. Thanks [@verygoodplugins](https://github.com/verygoodplugins)! [#2716](https://github.com/gocodebox/lifterlms/issues/2716)
+ Avoid errors on pages restricted by one or more memberships. [#2714](https://github.com/gocodebox/lifterlms/issues/2714)


v7.7.1 - 2024-08-09
-------------------

Expand Down
2 changes: 1 addition & 1 deletion class-lifterlms.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class LifterLMS {
*
* @var string
*/
public $version = '7.7.1';
public $version = '7.7.2';

/**
* LLMS_Assets instance
Expand Down
17 changes: 4 additions & 13 deletions includes/class-llms-db-ugrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class LLMS_DB_Upgrader {
*/
public function __construct( $db_version, $updates = null ) {

if ( ! LLMS_Install::$background_updater ) {
LLMS_Install::init_background_updater();
}
$this->updater = LLMS_Install::$background_updater;

// Background updates may trigger a notice during a cron and notices might not be available.
Expand All @@ -62,7 +65,6 @@ public function __construct( $db_version, $updates = null ) {

$this->db_version = $db_version;
$this->updates = $updates;

}

/**
Expand Down Expand Up @@ -98,7 +100,6 @@ public function can_auto_update() {
* @param LLMS_DB_Upgrader $upgrader Instance of the database upgrader.
*/
return apply_filters( 'llms_can_auto_update_db', $autoupdate, $this->db_version, $this );

}

/**
Expand Down Expand Up @@ -129,7 +130,6 @@ protected function get_callback_prefix( $info, $version ) {
}

return '';

}

/**
Expand Down Expand Up @@ -178,7 +178,6 @@ public function enqueue_updates() {
$this->updater->save();

add_action( 'shutdown', array( 'LLMS_Install', 'dispatch_db_updates' ) );

}

/**
Expand All @@ -199,7 +198,6 @@ public function get_updates() {
* @param LLMS_DB_Upgrader $upgrader Instance of the database upgrader.
*/
return apply_filters( 'llms_db_updates_list', $this->updates, $this );

}

/**
Expand All @@ -217,12 +215,11 @@ public function get_required_updates() {

return array_filter(
$this->get_updates(),
function( $update_version ) use ( $db_version ) {
function ( $update_version ) use ( $db_version ) {
return version_compare( $db_version, $update_version, '<' );
},
ARRAY_FILTER_USE_KEY
);

}

/**
Expand All @@ -236,7 +233,6 @@ public function has_required_updates() {

$required = $this->get_required_updates( $this->db_version );
return ! empty( $required );

}

/**
Expand Down Expand Up @@ -264,7 +260,6 @@ protected function show_notice_pending() {
'default_path' => LLMS_PLUGIN_DIR . 'includes/admin/views/notices/',
)
);

}

/**
Expand All @@ -284,7 +279,6 @@ protected function show_notice_started() {
'dismiss_for_days' => 0,
)
);

}

/**
Expand Down Expand Up @@ -313,7 +307,6 @@ public function show_notice_complete() {
'dismiss_for_days' => 0,
)
);

}

/**
Expand Down Expand Up @@ -341,7 +334,5 @@ public function update() {
}

return true;

}

}
36 changes: 13 additions & 23 deletions includes/functions/llms.functions.access.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ function llms_page_restricted( $post_id, $user_id = null ) {

/* This filter is documented above. */
return apply_filters( 'llms_page_restricted', $results, $post_id );

}

/**
Expand Down Expand Up @@ -355,7 +354,6 @@ function llms_is_post_restricted_by_drip_settings( $post_id, $user_id = null ) {
$is_available = ( $drip_bypass && $user_id && llms_is_complete( $user_id, $lesson_id, 'lesson' ) ) || $lesson->is_available();

return $is_available ? false : $lesson_id;

}

/**
Expand Down Expand Up @@ -443,7 +441,6 @@ function llms_is_post_restricted_by_prerequisite( $post_id, $user_id = null ) {

// Otherwise return false: no prerequisite.
return false;

}

/**
Expand Down Expand Up @@ -491,7 +488,6 @@ function llms_is_post_restricted_by_time_period( $post_id, $user_id = null ) {
$course = new LLMS_Course( $course_id );

return $course->is_open() ? false : $course_id;

}

/**
Expand Down Expand Up @@ -529,28 +525,25 @@ function llms_is_post_restricted_by_membership( $post_id, $user_id = null ) {
return false;
}

$memberships = get_post_meta( $post_id, '_llms_restricted_levels', true );
$restricted = get_post_meta( $post_id, '_llms_is_restricted', true );
$restricted_ids = array();
$memberships = get_post_meta( $post_id, '_llms_restricted_levels', true );
$restricted = get_post_meta( $post_id, '_llms_is_restricted', true );

if ( 'yes' === $restricted && $memberships && is_array( $memberships ) ) {

$student = llms_get_student( $user_id );
$restriction_ids = array();
$student = llms_get_student( $user_id );

if ( ! $student ) {
$restriction_ids = $memberships;
} else {
// loop through the memberships.
foreach ( $memberships as $mid ) {
foreach ( $memberships as $mid ) {
if ( ! is_numeric( $mid ) || absint( $mid ) === 0 ) {
continue;
}

// set this as the restriction id.
$restriction_ids[] = absint( $mid );
$restriction_ids[] = absint( $mid );

// once we find the student has access break the loop,
// this will be the restriction that the template loader will check against later.
if ( $student->is_enrolled( $mid ) ) {
break;
}
// once we find the student has access break the loop,
// this will be the restriction that the template loader will check against later.
if ( $student && $student->is_enrolled( $mid ) ) {
break;
}
}

Expand All @@ -559,7 +552,6 @@ function llms_is_post_restricted_by_membership( $post_id, $user_id = null ) {
}

return false;

}

/**
Expand Down Expand Up @@ -623,7 +615,6 @@ function llms_is_post_restricted_by_sitewide_membership( $post_id, $user_id = nu
return false;

}

}

/**
Expand All @@ -648,5 +639,4 @@ function llms_is_quiz_accessible( $post_id, $user_id = null ) {
}

return false;

}
2 changes: 1 addition & 1 deletion lifterlms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.1
* Version: 7.7.2
* Author: LifterLMS
* Author URI: https://lifterlms.com/
* Text Domain: lifterlms
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lifterlms",
"version": "7.7.1",
"version": "7.7.2",
"description": "LifterLMS by codeBOX",
"repository": {
"type": "git",
Expand Down

0 comments on commit eb3da8f

Please sign in to comment.