• Resolved plaidpowered

    (@plaidpowered)


    Hello,
    Our WordPress install uses EDD to send emails with custom templates, and we just recently installed Lifter.
    We ran into a bug with the way the template functions are loaded in Lifter that caused our email templates to throw a fatal error – here’s the relevant error stack:

    
    PHP message: PHP Fatal error: Uncaught Error: Call to undefined function is_lifterlms() in /www/[...]/wp-content/plugins/lifterlms/includes/class.llms.nav.menus.php:223
    Stack trace:
    #0 /www/[...]/wp-includes/class-wp-hook.php(289): LLMS_Nav_Menus->menu_item_classes(Array)
    #1 /www/[...]/wp-includes/plugin.php(212): WP_Hook->apply_filters(Array, Array)
    #2 /www/[...]/wp-includes/nav-menu-template.php(226): apply_filters('wp_nav_menu_obj...', Array, Object(stdClass))
    #3 /www/[...]/wp-content/themes/[...]/edd_templates/emails/footer.php(76): wp_nav_menu(Object(stdClass))
    

    At line 76 of THEME/edd_templates/emails/footer.php, we call the wp_nav_menu function.

    I dug around in the source code for Lifter, and I believe the problem is due to the LifterLMS template functions (lifterlms/includes/llms.template.function.php) not being loaded until the init WordPress action. I haven’t confirmed this yet, but it seems that the EDD emails are being generated before the init hook, and so at that point, the is_lifterlms() function hasn’t been defined yet, even though Lifter has already hooked into the wp_nav_menu_objects filter.

    I can understand the solution to this might be complicated. To quickly fix our issue, I defined is_lifterlms() in our email templates, and had it return false, so that the fatal error would not occur. I believe a more permanent solution would involve changing the priority of when the llms.template.functions.php file is loaded (perhaps moving just the is_lifterlms() function definition to the plugins_loaded hook), or ensuring the LLMS_Nav_Menus->menu_item_classes function isn’t added to the wp_nav_menu_objects filter until after init has been called and the template functions are available.

    Please let me know if I can be of more assistance debugging this problem.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug report: Conflict with EDD email templates and LifterLMS template functions’ is closed to new replies.