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

    Is that possible to get lessons with searched keyword?

    Lessons are intentionally excluded from search results because their content is only ever available to enrolled users.

    We’ve been criticized for this as some users don’t think that exposing lesson content via search is a problem. In that case you can easily modify this behavior with a small bit of code:

    https://gist.github.com/thomasplevy/126a0712283d1cced6c6216cdca64652

    If that’s foreign to you you can check out our guide on how to add custom code like this to your site: https://lifterlms.com/docs/how-do-i-add-custom-code-to-lifterlms-or-lifterlms-launchpad/

    If that doesn’t help you could hire a developer to assist you: https://lifterlms.com/experts

    Moreover I would like to get returned lessons what contains this string but require some rights to view it or at least some info that content is available for members etc

    The key reason we don’t expose lesson content in search is because it gets pretty complicated. Ideally the default functionality of LifterLMS would be to allow lessons to be searchable but only by users who have access to that lesson content.

    Given the methods that are currently available we’d need to filter result sets based on the ability to access that content on page load after a search. It gets pretty complicated here because there’s not straightforward way to do this. It’s not a completely impossible-to-solve problem but it’s something I simply haven’t figured out how to do yet because it’s not a terribly high priority issue in our minds.

    So the answer is that this is possible but I don’t know how to do it. One day I’d like to solve this for all users but it’s not currently a priority.

    My apologies,

    Thread Starter przembar

    (@przembar)

    Thanks for the good answer and the code.
    In my case I enabling search only for members. They can see all lessons from other membership – is not a problem at all.
    I wonder about two things:
    1. Security: Can user access somehow to full lesson content (if they are not members of plan of lesson found). In search they see only an excerpt (I tested it an it looks fine)?
    2. Code: I check if user has membership by using llms_is_user_enrolled(). Is there a function to check if user is enrolled to membership by category or tag assigned to membership likellms_is_user_enrolled_category(user_id, "free")? So I can simply add tag/category to membership – can_search an it will automatically have possibility to search all the content.

    Cheers and thanks for all the hints.

    • This reply was modified 6 years, 6 months ago by przembar.

    1. Security: Can user access somehow to full lesson content (if they are not members of plan of lesson found). In search they see only an excerpt (I tested it an it looks fine)?

    “I tested it and it looks fine” is your answer. Lessons are restricted based on *course* enrollment. If you expose the excerpt during search it will not affect the users actual enrollments when they navigate to the permalink of the lesson.

    2. Code: I check if user has membership by using llms_is_user_enrolled(). Is there a function to check if user is enrolled to membership by category or tag assigned to membership likellms_is_user_enrolled_category(user_id, “free”)? So I can simply add tag/category to membership – can_search an it will automatically have possibility to search all the content.

    LifterLMS does not have a concept of enrollment by tag or category so no, this function does not allow you to check enrollment by category or tag.

    Categories and tags are a way of organizing courses/memberships for browsing. There’s NO associations between these organizational taxonomies and user enrollments.

    During an enrollment your users doesn’t select a category to join, they select a membership (or a course). You know what I mean?

    By the way, you can search the core internal api at developer.lifterlms.com if you’re looking for other potentially useful functions!

    Best,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WordPress search to return all lessons containing string’ is closed to new replies.