• Resolved Imran Malik

    (@imranmalix)


    HI thank you for the great plugin. I saw that you have shortcodes for “My Achievements”, how about shortcodes (or block) for “My Grades”.

    The reason for this is we’re creating custom dashboard for user and plan to display “My Grades” only inside it.

    Not just “My Grades” but if each endpoint in “My Account” has its own shortcodes that would be great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nick Mariano

    (@reddotinmotion)

    Hi @imranmalix,

    Currently, we don’t have a “My Grades” shortcode as you can see in lifterlms.com/docs/shortcodes. As a workaround, you can create you own shortcode whose output is based on the file at wp-content/plugins/lifterlms/templates/myaccount/my-grades.php. The variables that are used inside that file are defined inside the lifterlms_template_student_dashboard_my_grades() function in wp-content/plugins/lifterlms/includes/functions/llms.functions.templates.dashboard.php

    Thread Starter Imran Malik

    (@imranmalix)

    Thanks for the guidance. I dont have background in coding. But with your information, google and chatgpt, managed to create custom shortcodes. Just sharing it here for everyone else reference.

    I use WPCode plugin>Add Snippet>PHP Snippet>Add below code>Run Everywhere>Activate/Update

    function custom_lifterlms_my_grades_shortcode() {
        if (!is_user_logged_in()) {
            return 'You need to be logged in to see your grades.';
        }
    
        ob_start();
    
        // The following function sets up the necessary variables for the template
        lifterlms_template_student_dashboard_my_grades();
    
        // Include the LifterLMS template file
        include plugin_dir_path( __FILE__ ) . 'wp-content/plugins/lifterlms/templates/myaccount/my-grades.php';
    
        return ob_get_clean();
    }
    
    add_shortcode('my_grades', 'custom_lifterlms_my_grades_shortcode');
    

    Then can use [my_grades] as the shortcodes.

    If anyone has better workaround or method, please share here. Thanks

    Plugin Support Alexander

    (@alextonio22)

    Hi @imranmalix

    Thank you for sharing the custom shortcode solution you created. Unfortunately, as per our support policy at LifterLMS, we do not provide support for custom code solutions.

    For further customization needs, you may consider hiring a developer. You can find qualified experts at this site: LifterLMS Experts.

    We appreciate your understanding.

    Plugin Support Nick Mariano

    (@reddotinmotion)

    Hi @imranmalix,

    You code works! Props to you for managing to pull this using ChatGPT. Just a side note, you do not need the line below so you can try deleting it.

    // Include the LifterLMS template file
        include plugin_dir_path( __FILE__ ) . 'wp-content/plugins/lifterlms/templates/myaccount/my-grades.php';
    

    I’m going to mark this issue as resolved now.

    • This reply was modified 6 months, 1 week ago by Nick Mariano.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode for My Grades’ is closed to new replies.