Mr.Canuck Posted August 2, 2013 Share Posted August 2, 2013 Can someone tell me the syntax error in this line of PHP code action="http://example.com" '/wp-login.php?action=postpass' method="post" Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 That is not PHP, that is a portion of HTML, most likely a form tag. Quote Link to comment Share on other sites More sharing options...
Mr.Canuck Posted August 2, 2013 Author Share Posted August 2, 2013 Here is the full code snippet: <?php function my_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '<form style="margin-left:265px" class="protected-post-form" action="http://example.com" '/wp-login?action=postpass' method="post"> ' . __( "To enter AIS Cloud, please enter the username which was provided to you:" ) . ' <label for="' . $label . '">' . __( "Username:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Login" ) . '" /> </form> '; return $o; } add_filter( 'the_password_form', 'my_password_form' ); ?> Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 action="http://example.com" '/wp-login?action=postpass' method="post"> What are those single quotes doing there? Quote Link to comment Share on other sites More sharing options...
Mr.Canuck Posted August 2, 2013 Author Share Posted August 2, 2013 I don't know. Honestly, I'm just trying to learn. Should I remove those single quotes like this? <?php function my_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '<form style="margin-left:265px" class="protected-post-form" action="http://example.com" /wp-login?action=postpass method="post"> ' . __( "To enter AIS Cloud, please enter the username which was provided to you:" ) . ' <label for="' . $label . '">' . __( "Username:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Login" ) . '" /> </form> '; return $o; } add_filter( 'the_password_form', 'my_password_form' ); ?> Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 (edited) That should be OK syntax wise, but this doesn't look right: action="http://example.com" /wp-login?action=postpass Maybe: action="http://example.com/wp-login?action=postpass" Also: http://us2.php.net/manual/en/language.types.string.php Edited August 2, 2013 by AbraCadaver Quote Link to comment Share on other sites More sharing options...
Mr.Canuck Posted August 2, 2013 Author Share Posted August 2, 2013 Thank you for your help so far. This part here has to be separated from the URL, as it controls the "check for password" function: wp-login?action=postpass If I do this action="http://example.com/wp-login?action=postpass" then when clicking the login button, it just takes me to the http://example.com site without verifying the password first. Is there a way to get the /wp-login?action=postpass to work? NOTE: If I do the code this way: <?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 enter our client area, please enter the password which was provided to you:" ) . ' <label for="' . $label . '">' . __( "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' ); ?> it works. It actually checks for the verified password like it is supposed to, but the siteurl isn't correct, as I need it to go to a specific URL like http://example.com Is there a way to use this line of code how it is, but make it not pull from . get_option( 'siteurl' ) but rather to go to http://example.com ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.