• Resolved jstead

    (@jstead)


    With our use-case, all users of our site are pre-enrolled into select courses. No courses can be enrolled in by and end-user, its all done by us as their user is created.

    I have been trying to use a shortcode to display ONLY courses that the logged in user is enrolled in.

    The mine attribute of the lifterlms_courses doesn’t look to work as described here: https://lifterlms.com/docs/shortcodes/#lifterlms_courses
    [lifterlms_courses mine=”enrolled”]
    The above shortcode shows all courses regardless on enrollment status.

    Cant remember where I found its reference, but I currently have [course-list] in my page, which up until last week was working (in that the course list for a new user was empty until I added them to the correct membership for certain courses). This has stopped working now as well and all lessons are displaying regardless enrolled/not-enrolled.

    Is there a shortcode method that could do the above? or should I target the not-enrolled class on .llms-loop>.llms-loop-item list item?

    Cheers,
    Jason

Viewing 3 replies - 1 through 3 (of 3 total)
  • @jstead,

    You have smart quotes on the shortcode you pasted in here ([lifterlms_courses mine=”enrolled”])

    You want to be using “dumb” quotes ([lifterlms_courses mine=”enrolled”])

    The difference is subtle but I think that’s what’s causing your issue. Since it’s using smart quotes the shortcode attribute isn’t being read properly and the default “no” is being utilized instead. This default is essentially turning OFF the mine functionality. When it’s off, it shows courses regardless of enrollment.

    [course-list] has not ever been a LifterLMS shortcode. Maybe you found it from another plugin you had installed that you’ve since disabled and that could explain why it stopped working?

    Hope that helps,

    It looks like the forms here convert everything to smart quotes…

    In that case I’m not entirely certain why the shortcode wouldn’t be working for you.

    I’ve tested it locally (with dumb quotes) and it does work as expected.

    Does this code snippet work?

    [lifterlms_courses mine="enrolled"]

    • This reply was modified 6 years ago by Thomas Patrick Levy. Reason: added shortcode example snippet within code field to prevent quote conversion
    Thread Starter jstead

    (@jstead)

    Hi @thomasplevy,

    I have tested the above shortcode with both types of quotes (”smart” and “dumb” or curved and straight versions) and I got it ‘kinda’ working. basically if the user is NOT enrolled in a course they see all courses, instead of no courses… But if they are enrolled in a course they only see that course, and not un-enrolled courses.

    I am testing with 2 courses and 2 memberships. First membership auto-enrolls users to ALL 2 courses, the second only enrolls the user into 1 course.

    When user was not a part of either membership, they saw both courses. When enrolled in the course giving access to only 1 course, they only saw this course and when in the other membership they saw both courses. Is it possible to return 0 courses if the user isn’t enrolled in any? also can the “you must be logged in message” be removed as we use the [lifterlms_login] short code directly above making it redundant.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User specific course list’ is closed to new replies.