Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Glad you like the plugin.

    What you are seeing is a shortcode that the plugin puts in on the fly to overcome the WP’s wpautop function. wpautop is what puts <p> tags into the $content variable, and that screws things up with the form layout.

    Some people like to shut this function off, where in other cases shutting it off would screw things up for the rest of the layout. So the plugin puts in an on-the-fly shortcode to shut wpautop off only for itself in the forms that go in the $content variable.

    Since the “page” parameters of the wp-members shortcode were intended for use as a page, your results may vary when used outside of that scope (like using it in the header).

    While I may put in some kind of a hook later on to eliminate the texturize shortcode down the road, at this time you don’t really have a way to get that shortcode to parse if you are calling the shortcode directly.

    Your solution is probably to use the wpmem_login_form filter to filter out the shortcode elements.

    Thread Starter Hassan

    (@hassanhamm)

    Chad, thanks for such an informative response.

    I haven’t just figured out the “issue”, I actually learned something new in the process –> wpautop 🙂

    So, using my not-so-super PHP skills I was able to come up with this code to use in my functions.php file, based on your suggestion:

    // Remove the opening [wpmem_txt] from login form
    function remove_open_wpmem_txt( $form ) {
    	$form = str_replace( '[wpmem_txt]', '', $form );
    	return $form;
    }
    add_filter( 'wpmem_login_form', 'remove_open_wpmem_txt' );
    
    // Remove the closing [/wpmem_txt] from login form
    function remove_close_wpmem_txt( $form ) {
    	$form = str_replace( '[/wpmem_txt]', '', $form );
    	return $form;
    }
    add_filter( 'wpmem_login_form', 'remove_close_wpmem_txt' );

    …which does the job, but I have a feeling it could be done in a better way maybe? Please DO tell if this code can be improved/enhanced.

    Thank you.

    Thread Starter Hassan

    (@hassanhamm)

    OFF-TOPIC:

    In the plugin’s css folder there is the file (wp-members-2012.css). In the beginning, specifically at line 4, there is this comment:

    “CSS for the WP-Members plugin using TwentyEleven Theme”

    I believe that should’ve been “CSS for the WP-Members plugin using TwentyTwelve Theme”?

    A Copy-paste-forgot-to-change typo? 🙂

    Plugin Author Chad Butler

    (@cbutlerjr)

    You are definitely on the right track. You don’t need two filters, though. You could do str_replace twice in one, or you could do it once with an array:

    $arr = array( '[wpmem_txt]', [/wpmem_txt]' );
    $form = str_replace( $arr, '', $form );

    or

    $form = str_replace( array( '[wpmem_txt]', [/wpmem_txt]' ), '', $form );

    (I think the Twenty Twelve stylesheet was probably built from the Twenty Eleven and the header didn’t get updated.)

    Thread Starter Hassan

    (@hassanhamm)

    Thanks, Chad. I was sure I could do it with an array.

    …and by the way you forgot a single quote in each of the two examples you provided above.

    This:

    $arr = array( '[wpmem_txt]', [/wpmem_txt]' );

    …should be:

    $arr = array( '[wpmem_txt]', '[/wpmem_txt]' );

    And this:

    $form = str_replace( array( '[wpmem_txt]', [/wpmem_txt]' ), '', $form );

    …should be:

    $form = str_replace( array( '[wpmem_txt]', '[/wpmem_txt]' ), '', $form );

    Just in case someone else was trying to use it and got an error.

    I’ve try most of the code snippets on this page and none of them seem to work. I added them to the functions page and the template page Specific to the problem and nothing happens same old [wpmem_txt]… any thoughts?

    Plugin Author Chad Butler

    (@cbutlerjr)

    Here’s a more thorough explanation of the issue and solution:
    http://rocketgeek.com/filter-hooks/remove-an-unparsed-wpmem_txt-shortcode/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘"[wpmem_txt]" text appears when outputting login page in template file’ is closed to new replies.