WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Passwords for Protected Pages
[resolved] Multiple passwords not working with custom password (5 posts)

  1. bonevet
    Member
    Posted 1 year ago #

    Hi,

    I have a custom password form and I've just installed the "Multiple Passwords for Protected Pages" plugin. It won't work unless I remove the code for the custom password form and revert to the standard wordpress form - it then works fine.

    Is there any way I can get it to work with my custom form?
    I've pasted the code for my custom form below - it is placed at the end of the functions.php file.

    Thanks
    Mark

    site is http://www.bonevet.co.uk

    <?php
    function my_password_form() {
        global $post;
        $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
        $o = '<form class="protected-post-form" action="' . get_option( 'siteurl' ) . '/wp-login.php?action=postpass" method="post">
        ' . __( "To access these Forms please enter your password below:   You may request a password under the CONTACT tab" ) . '
     
     
    
        <label for="' . $label . '">' . __( "Enter Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
     
     
    
        </form>
        ';
        return $o;
    }
    add_filter( 'the_password_form', 'my_password_form' );
    ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

    http://wordpress.org/extend/plugins/baw-multiple-pass-for-protected-pages/

  2. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Hello

    Try this :

    <?php
    function my_password_form() {
        global $post;
        $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
        $o = '<form class="protected-post-form" action="' . get_option( 'siteurl' ) . '/wp-login.php?action=postpass" method="post">
        ' . __( "To access these Forms please enter your password below:   You may request a password under the CONTACT tab" ) . '
    
     	<input type="hidden" name="post_id" value="' . $post->ID .'" />
    	<input type="hidden" name="action" value="bawmmp_multiple_password_check" />
    
        <label for="' . $label . '">' . __( "Enter Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
    
        </form>
        ';
        return $o;
    }
    add_filter( 'the_password_form', 'my_password_form' );
    remove_action( 'the_password_form', 'bawmpp_the_password_form' );
    ?>
  3. bonlando
    Member
    Posted 1 year ago #

    Hello Julio - This function actually does not work...im really hoping I can find a way to get this to work...i've pasted it into my functions, and anytime you enter a password it directs them to the wordpress admin login screen.

    The plugin works great if you do not have a cutom login screen - but my client requires it.

    Thanks!

  4. GustavoPolo
    Member
    Posted 10 months ago #

    Hey bonlando,

    Were you able to figure this out? I kinda need the same thing.

  5. sull
    Member
    Posted 9 months ago #

    works if you remove the form action and keep the input action.

    remove:
    action="' . get_option( 'siteurl' ) . '/wp-login.php?action=postpass"

    keep:
    input type="hidden" name="action" value="bawmmp_multiple_password_check"

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic