• Resolved montrealist

    (@spectrus)


    Hi,

    Just tried validating a page with WP-Members login form, and found out that the way form is being populated in wpmem_login_form_NEW() (inside wp-members-dialogs.php) messes up the markup, since piece of PHP code like this

    $form = '<div id="wpmem_login">
    <fieldset>
    <legend>' . $arr[0] . '</legend>
    <form action="' . get_permalink() . '" method="POST" class="form">
    <div class="signInBoxes"><label for="username">' . $arr[1] . '</label>
    <div class="div_text">';

    ends up looking like this in the markup:

    <fieldset>
    <legend>Existing users Login</legend>
    <form action="/login" method="POST" class="form">
    <div class="signInBoxes"><label for="username">Username</label></p>
    <div class="div_text">

    See the orphan closing </p> tag? It’s due to WordPress “wpautop”-ing all the stuff going through the_content, and WP-Members certainly falls into that.

    Has it ever been considered to make all forms template-able? As in check the template folder first, and if the file with a certain template name doesn’t exist, then fall back to the default way of form population? I’ve seen plugins do that before (wp-favorite-posts for example). Then we’d be able to easily override that behaviour and avoid the issue altogether.

    Thanks for reading. =)

    http://wordpress.org/extend/plugins/wp-members/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter montrealist

    (@spectrus)

    Oh, I just noticed this at the top of the function:

    remove_filter( 'the_content', 'wpautop' );

    For some reason the paragraphs are still being populated. Any ideas?

    Plugin Author Chad Butler

    (@cbutlerjr)

    Yes, I am working on some work-arounds with the wpautop. In the present version, this is applied to the login form specifically, but there is another fix release coming that will apply it to the reg form as well.

    I have considered the template process (and a couple other ideas), but haven’t had a chance to move that piece forward. However, the plugin does offer the option of loading a separate stylesheet.

    Thread Starter montrealist

    (@spectrus)

    Absolutely, and it’s a great thing. However, my overall page structure was breaking only due to the messy markup mentioned above. If anyone ever runs into a similar issue, here’s a workaround I came up with.

    Important note: if you use it, you will need to merge these modifications with any upcoming plugin releases!

    I’ve wrapped the wpmem_login_form_NEW() function (inside wp-members-dialogs.php) into an if-elseif-else that checks to see if there is a template file present in the theme (or child theme, hence the else) directory, and includes it instead of the default function if it is:

    if(@file_exists(TEMPLATEPATH.'/wp-members-template-login.php')) :
        include(TEMPLATEPATH.'/wp-members-template-login.php');
    elseif(@file_exists(STYLESHEETPATH.'/wp-members-template-login.php')) :
        include(STYLESHEETPATH.'/wp-members-template-login.php');
    else:
    
    if ( ! function_exists( 'wpmem_login_form_NEW' ) ):
    /**
     * rest of javadoc omitted for brevity
     */
    function wpmem_login_form_NEW( $page, $arr )
    {
    // .. rest of function code omitted for brevity
    }
    endif;
    endif;
    Plugin Author Chad Butler

    (@cbutlerjr)

    Another possibility is that any function in the plugin that is wrapped with if( ! function_exists( 'wpmem_name_of_function' ) ) :, can be plugged by creating your customization in wp-members-pluggable.php saved to your /plugins/ directory. That way, you don’t have to re-do when you upgrade (although you should still check that the function(s) in question haven’t been modified).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-Members] login form population and wpautop messing with markup’ is closed to new replies.