Support » Plugin: LifterLMS » Sections and lessons swapping places

  • Barry Sampson

    (@barrysampson)


    Hi,

    I have a very odd issue on a site that I help support. Someone created a course and then added sections and lesson in the course builder – so far, so good. At some point some of the lessons and sections swapped places.

    We started with something like:

    Section 1
    – 1.1 Lesson
    – 1.2 Lesson
    – 1.3 Lesson

    Section 2
    – 2.1 Lesson
    – 2.2 Lesson
    – 2.3 Lesson

    This changed to:

    1.2 Lesson
    – 1.1 Lesson
    – Section 1
    – 1.3 Lesson

    2.3 Lesson
    – 2.1 Lesson
    – 2.2 Lesson
    – Section 2

    My first thought was user error, but then I couldn’t find any way to recreate this through the course builder (or any other part of the UI). Nor could I find any way to unravel this through the UI.

    I was able to resolve this but only by manually updating ‘post_type’ in wp_posts and the ‘_llms_parent_section’ key in wp_postmeta.

    The sections had definitely previously been lessons, because as soon as I changed their post type back to lesson I was able to see the lesson content they contained.

    My question: how did this happen and what action do we need to take to stop it happening again?

    Thanks

    Barry

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Natalie

    (@nrherron)

    Hi @barrysampson,

    I’m sorry your client had this issue!

    I’m not sure what could have caused this to happen just based on this information.

    Could you provide us with the site’s system report: https://lifterlms.com/docs/how-to-use-the-lifterlms-system-report/ (When posting your report, please follow the guidelines for posting code: https://wordpress.org/support/forum-user-guide/faq/#i-need-to-post-code-is-that-okay .) This will help us rule out any kind up update conflicts or plugin conflicts.

    Were the posts saved in order from the start, or did the order change right after it was saved?

    Did you encounter any error messages while you were fixing this for your client?

    Any further information you can provide us so we can try and take a shot at troubleshooting the issue on a local site is helpful!

    Thanks and take care,

    Barry Sampson

    (@barrysampson)

    Hi Natalie,

    Thanks for getting back to me. To answer your questions:

    I believe that the sections and lessons were saved in order and they changed later.

    I didn’t encounter any error messages, but when I was fixing this the only way I could do so was updating the db through the terminal.

    When I saw the issue, my initial thought was that it was user error (this particular person had previously said she had problems with ‘things changing by themselves’). However, I can’t see how any end user could cause this to happen.

    The site has been running since late 2017 and this problem has only occurred now.

    The system report is here: https://gist.github.com/barrysampson/1140db18775247c097a16e7ef67bfa61

    Many thanks

    Barry

    Plugin Author Thomas Patrick Levy

    (@thomasplevy)

    @barrysampson,

    It sounds to me as if you may have some custom code on your site somewhere (or another plugin) which is inadvertently overwriting the queries LifterLMS users to order sections & lessons.

    It feels incredibly unlikely to me that a bug in LifterLMS caused these to switch. This is a pretty fundamental part of the codebase and I cannot recreate this either.

    I’m pretty adept at figuring out how something happened based on my knowledge of the codebase (I’ve personally authored probably 80% of the code in LifterLMS and anything I haven’t authored I’ve reviewed thoroughly) so many times with “weird” things like this I can figure out how it could have happened and then recreate and then improve the code to prevent it from happening in the future.

    A few clarifying questions:

    1) Have you seen this happen on more than once course?
    2) Were there any plugins / updates made right around the time or before you saw this happen? That could be plugin/theme updates or installations or new custom code added to your child theme.
    3) Did this visually happen on the admin panel AND on the frontend of your site (eg was the course outline reflecting this same behavior or just the outline within the builder). This could signal javascript wreaking havoc on the builder and reordering things by accident visually.
    4) Since you made changes in the database to fix this is this something you do regularly (make changes to things manually in the database). And, if so, is there any possibility that you could have inadvertantly written and executed a query that could have mixed up the data for the course structure?

    I really have no idea where to start with trying to tell you how this happened. I don’t know. I’ve never seen this happen before and I cannot come up with any reason it happened.

    If you can provide me with clear reproduction steps I can fix it but right now we’re both just guessing at something that neither of us can recreate and I really have no idea what to do about it…

    Barry Sampson

    (@barrysampson)

    Hi Thomas,

    Thanks for getting back to me. It is a very strange issue and I don’t recall seeing anything quite like it before.

    I’m happy that it isn’t a bug, but I’m also pretty confident it isn’t custom code or another plugin causing the issue. There are two reasons I say that – The first is that for various reasons, we are only able to run plugin updates every 3-4 months, and we’re coming to the end of that current cycle, so if it was another plugin I would have expected to see this happen earlier. On the custom code side, we have remove one Lifter action in the functions.php file. Everything else is contained in a site specific plugin and everything in there deals with permissions, login/logout routing, and styling H5P. Nothing has changed in that plugin for some time.

    In answer to your questions:

    1) No, just the one course.
    2) Yes, we made some out of cycle changes in the same week. Most of this was updates to the child theme style sheet. We already had a custom my-grades.php template and we amended that to remove a column from the table. Given that no other course were affected I don’t think this was responsible.
    3) Yes, course builder, lesson admin and front end all showed the same thing.
    4) No, that is the first time I’ve ever made direct db changes to this site. It’s very much the option of last resort!

    The one unique factor in this is the particular course creator. I’m not blaming her, because as I said in the first post I can’t see how she could have caused this. However, there are ten plus course creators and no one else has had an issue like this. She previously reported ‘things changing on their own’ which at the time I did put down to user error. I’m now wondering if it is some kind of IT issue at her end. The course creators all work for the same organisation, but they are in different locations and have different IT set ups. I do remember meeting with all of them and thinking that some were using very old browsers. Maybe that’s somehow screwing up things on the JavaScript side.

    Thanks again for your help, I think for now it’s watch and wait and see if this happens again.

    Barry

    Plugin Author Thomas Patrick Levy

    (@thomasplevy)

    @barrysampson,

    I’m happy that it isn’t a bug

    I can’t say one way or another whether this is a bug but it’s sounding to me like it’s not. Again, we have a large number of users and I keep a close personal eye on issue and bug reports. I would have heard about this from a lot of users if this was a widespread issue. You’d be seeing it regularly too also I’m sure.

    I will not officially call anything a bug until I can figure out how to reliably recreate it!

    The one unique factor in this is the particular course creator. I’m not blaming her, because as I said in the first post I can’t see how she could have caused this. However, there are ten plus course creators and no one else has had an issue like this. She previously reported ‘things changing on their own’ which at the time I did put down to user error. I’m now wondering if it is some kind of IT issue at her end. The course creators all work for the same organisation, but they are in different locations and have different IT set ups. I do remember meeting with all of them and thinking that some were using very old browsers. Maybe that’s somehow screwing up things on the JavaScript side.

    Who knows what is possible with old browsers and with browser extensions.

    I’ve seen browser extensions wreak havoc on javascript interfaces before and I’ll see it again.

    I *do not* test LifterLMS against outdated browsers. I test against the current versions of the major vendors. If someone wants to use IE8 that’s they’re problem. I’ve long since stopped wasting my time dealing with this tiny percentages of issues.

    That said, you could pretty easily determine if this is an issue with a particular browser/browser version by having this particular user try to recreate the issue and requesting browser/version information from them if the user can continue to recreate it.

    For now I’m not sure what else to do here. I’m partial to calling this user error / outdated browsers but I’ll leave that up to you.

    If you do wish for me to continue an investigation here I will insist that you can provide me with steps I can take to reliably reproduce this. I have a lot of other recreateable issues and new features to work on. I can’t chase issues I can’t recreate (and even the person reporting can’t recreate).

    I hope you can understand my stance here.

    Best,

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.