• ibro87

    (@ibro87)


    Hi there, 

    First of all, great plugin! I'm trying to override login.php form with my own without modifying core plugin files. For this reason, I have created a child plugin following the same plugin structure (e.g. /wp-content/plugins/ajax-login-and-registration-modal-popup-pro-child-plugin/free/views/form-parts/login.php). I've placed the main .php file (login-registration-modal-pro-child-plugin.php) within the child plugin folder, telling WordPress to use this instead of the parent plugin. Here's the code I used:

    <?php

    // Hook to override the login form template in the parent plugin
    add_filter('lrm/login_form_template', 'custom_login_form_template', 10, 2);

    function custom_login_form_template($template, $args) {
    // Check if the parent plugin is active
    if (is_plugin_active('ajax-login-and-registration-modal-popup-pro/login-registration-modal-pro.php')) {
    // Provide the path to the modified login.php in your child plugin
    $template = plugin_dir_path(FILE) . 'free/views/form-parts/login.php';
    }
    return $template;
    }

    FYI, both parent and child plugins are active. However, this didn't work and login.php file was still loaded from the parent plugin which is not what I want because I want to preserve my changes even when parent plugin is updated. Could it be that I used the wrong filter? If so, could you please tell me correct one which renders login form and point me in the right direction to make this work.

    Many thanks in advance!
    • This topic was modified 1 month ago by ibro87.
    • This topic was modified 1 month ago by ibro87.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Max K

    (@kaminskym)

    Hey,

    Unfortunately I can’t find that filter ‘lrm/login_form_template’ inside the plugin, I’ll try to add it and will let you know.

    Max

    Thread Starter ibro87

    (@ibro87)

    Hi there,

    Sounds good. In the meantime, could you please clarify which existing filer can be used in order to override original login.php file? Thanks again!

    Thread Starter ibro87

    (@ibro87)

    For example: WooCommerce gives very clear instructions how to override their templates (“This template can be overridden by copying it to yourtheme/woocommerce/myaccount/my-downloads.php.”). This works, so if you could do the same for your plugin, that would be very helpful.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.