[Support request] Displaying custom blocks inside Tutor LMS pages/templates

Home Forums Support [Support request] Displaying custom blocks inside Tutor LMS pages/templates

Home Forums Support Displaying custom blocks inside Tutor LMS pages/templates

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #2262657
    Tomáš

    Hello,

    I would like to ask you for a help with adding a custom elements (blocks) inside Tutor LMS pages/templates.

    For example: I would like to add a simple heading after the course enrolment button.

    How would I go about doing that?

    I played a bit with custom elements (Appearance -> Elements -> Add new -> Block), I set the location to “Course” and then on a sidebar I choosed “Element type -> Hook” , and for Hook name I choosed “Custom hook”.

    Then I tried to look up the tutor lms documentation and I found this: https://docs.themeum.com/tutor-lms/developers/hooks/

    But honestly I don’t know how to use this.

    Any help would be much appreciated. Thank you.

    #2262663
    Leo
    Staff
    Customer Support

    Hi there,

    then on a sidebar I choosed “Element type -> Hook” , and for Hook name I choosed “Custom hook”.

    That’s the correct method. From there, you would need to enter the name of the custom hook and it depends on where you are trying to insert the content.

    This is something you will need to check with TutorLMS’ support team.

    I don’t believe the page you’ve linked is what you need but their support team should be able to clarify.

    #2263143
    Tomáš

    So I wrote to Tutor LMS support and they responded with this:

    “You can use this hook to add: https://docs.themeum.com/tutor-lms/developers/hooks/templates/#course-enroll-box-php”

    However, I am not quite sure how to target this and what should I enter in “Custom hook” field.

    Could you please help me with this?

    #2263160
    David
    Staff
    Customer Support

    Hi there,

    1. Create your block element.
    2. Set the Element Type to Hook.
    2.1 in the hook list select Custom Hook.
    2.2 in the Field paste in:

    tutor_course/single/enroll_box/after_thumbnail

    3. Set your Display Rules > Location to the Tutor Course Single ? – i am not sure what it will be called but look through the list of options.

    #2263161
    Tomáš

    Thank you David. I did exactly the same as you state above but it doesn’t work.

    As for a display rules, there is a location “Course”. So I set that.

    But when I did exactly this, it doesn’t work. Would it help you if I give you a temporary access to my site?

    #2263180
    David
    Staff
    Customer Support

    Can you link me to the page where it should display ?

    If i need a login or anything, then you can share those details in the Private Information field.

    #2263181
    Tomáš

    Sure David, here is the course page.

    https://popokatepetl.com/courses/something-course/

    #2263211
    David
    Staff
    Customer Support

    If you temporarily change the Hook to: before_header which is in the list of hooks. Does your block element content display? It should be above the site header

    If it does, then we know the Display Rules are correct and the custom hook is bad

    #2263484
    Tomáš

    So I changed the hook to before_header and it does display on the frontend as it should.

    So, the custom hook we try to locate is bad.

    I noticed that after I add this hook tutor_course/single/enroll_box/after_thumbnail in GP Theme (custom hook), after I save it and reload the page, it loses those / (slashes), so therefore, it looks like this tutor_coursesingleenroll_boxafter_thumbnail

    #2263951
    David
    Staff
    Customer Support

    To be honest i have never seen hook method with / being used in this way before.

    Can you check with Tutor on how they expect us to use it ?

    #2265722
    Tomáš

    Hello David,

    so I wrote to Tutor LMS Support and I got this answer:

    As he was referring to this hook tutor_course/single/enroll_box/after_thumbnail , you can use this, using this you can add your custom section.

    Best Regards,

    Which, I would say, doesn’t help us in any way..question is what now?

    #2265754
    David
    Staff
    Customer Support

    Try adding this PHP Snippet to your site:

    add_action('tutor_course/single/enroll_box/after_thumbnail', function(){
        echo 'if i see this text then the hook is working';
    });

    Do you see the text appear on the page ?

    #2265761
    Tomáš

    I added the above PHP snippet and the text “if i see this text then the hook is working” is displaying on every page before the <header> tag

    #2265764
    David
    Staff
    Customer Support

    Ok – so…. i have no clue how that Hook is meant to work then lol

    Could you share this topic with them? So they can see what we’re trying to do and maybe educate us on how to do it properly?

    #2268436
    Tomáš

    So I received this message from Tutor LMS:

    I think This customization will not gonna work with this hook. Send me a screenshot of exactly where after the course enrollment button you want to add the heading. I will try to share the direct code if possible. The hook is not going to work.

    And then, they provided me with the following function:

    function your_func(){
    echo 'here add custimiztion';
    }
    
    add_action('tutor_course/single/enroll_box/after_thumbnail', 'your_func');

    So if I am right, does this mean that I won’t be able to use GeneratePress hook system to display elements? Or is there any easier way than to write custom functions?

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.