WordPress.org

Ready to get started?Download WordPress

Forums

SimpleModal Login
Inconsistent Implementation of login_form Hook (3 posts)

  1. thenbrent
    Member
    Posted 3 years ago #

    Great work on a well written plugin!

    I've come across an issue with the do_action('login_form') hook.

    The wp-login.php file runs the do_action('login_form') hook as the login form is being printed. SimpleModal on the other hand builds the login form as a variable, runs the hook during this process, and then prints the entire form later.

    Many plugins that hook to do_action('login_form') print output, meaning if used with SimpleModal, output will be printed outside of the login form.

    I know I can get around it unhooking functions and using the simplemodal_login_form filter but it would be much better to have the login_form hook act consistently with that in wp-login.php.

  2. Eric Martin
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for your feedback.

    I certainly don't want to have the plugin act inconsistently with what is expected.

    Off the top of my head, I'm not sure what the best way would be to change the plugin to 1) act consistently and 2) work as needed. If you have any suggestions, I'd be happy to hear them.

    -Eric

  3. thenbrent
    Member
    Posted 3 years ago #

    Hi Eric,

    The least obtrusive method would be to wrap the do_action calls in an output buffer and append the output, like so:

    ob_start();
    do_action('login_form');
    $output .= ob_get_clean();
    ob_start();
    do_action('register_form');
    $output .= ob_get_clean();

    Hope that helps.

    Brent

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic